Giter Club home page Giter Club logo

Comments (5)

luispadron avatar luispadron commented on May 16, 2024

You're going to have to be more specific, I don't understand what you're asking.
Provide code samples or be more clear in your question.

You can read the documentation here

There you should see that to change the animation duration, you have to call setProgress(value:animationDuration:completion:) where animationDuration is the amount of seconds you would like to animate for.

from uicircularprogressring.

yogesh2209 avatar yogesh2209 commented on May 16, 2024

function animate with duration = 1.0 is not working on seconds basis.
I have tried with duration = 1, 10, 20, 30 and so on. Nothing works.
I just want it to animate per second i.e on seconds basis. So, for that, what should be the duration to animate it per second ?
FUNCTION:
setProgress(value: 30, animationDuration: 1.0)

It is not animating on a second basis.
I compared it with stopwatch. It was not animating on per second basis.

from uicircularprogressring.

luispadron avatar luispadron commented on May 16, 2024

I'm not doing any custom animations with this view. I use the built in animation system from Apple.

Here is the code which calls the animation

if event == "value" && self.animated {
            let animation = CABasicAnimation(keyPath: "value")
            animation.fromValue = self.presentation()?.value(forKey: "value")
            animation.timingFunction = CAMediaTimingFunction(name: animationStyle)
            animation.duration = animationDuration
            return animation
}

The animation duration is the value passed in when setProgress is called. Animation style can be change by assigning animationStyle for the ring view. The list of timing functions can be found here.

Now as for the animation duration not being exact, I'm not sure why you're having that issue, I just tested it out with a stop watch as well and they seem to stop around the same time sent to the function (in seconds).

Have you taken a look at the example project? If you don't mind posting your code, i can help further.

from uicircularprogressring.

yogesh2209 avatar yogesh2209 commented on May 16, 2024

kCAMediaTimingFunctionLinear should work on a linear basis i.e animation should work linearly without speeding fast or slow at any time. Right?

If i put total time = 30 seconds and compare it with stopwatch, it works fine but distribution of animation duration is not exact. It first slows, then speeds up and then becomes slow when reaching near the total. technically, it should be linearly distributed. No speed slow or quick.
Got my point?
I am using linear timing function, still, it is not working.
ring.animationstyle = kCAMediaTimingFunctionLinear

I am doing it in your example project only. I will implement it in my app after i will do it on example project first.

from uicircularprogressring.

luispadron avatar luispadron commented on May 16, 2024

Huh thanks for bringing this to my attention.
For some reason I wasn't updating the layers animationStyle.

Fixed in latest release, 1.1.3

run pod update for latest changes

Will close issue unless you have something else.

from uicircularprogressring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.