Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to stop/reset animation to start new one? #28

Open
ghost opened this issue Oct 10, 2019 · 0 comments
Open

Any way to stop/reset animation to start new one? #28

ghost opened this issue Oct 10, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Oct 10, 2019

Hi, thanks for this open source project. Like it so far but cannot get some wanted behavior.
I want to use single circular bar for multiple cases, or dynamically change its current progress.
But, as soon as I start animation there is no way to reset it to another value to start new animation.

For example I tried to start animation from 0.6 to 0 in 600 seconds.
After some user progress, I want to reset animation without waiting it to finish all 10 minutes, for example, to progress 0.8 and animate to 0 in 300 seconds.
But it just starts from previous animation last position and resets timer to 300 even if very small portion left, it divides that portion into.. 300 seconds.
Im trying to set its inital value too, not only duration.

I tried so far

popupProgressCircle.progress = 0.8 // Doesnt work if animation in progress
popupProgressCircle.set(progress: 0.8, duration: 0)  // Also doesnt work if animation in progress
popupProgressCircle.set(progress: 0.8, duration: 0.000001) // This just breaks everything, may be because next part is called immediately, and code execution is faster than 0.000001

popupProgressCircle.set(progress: 0, duration: 300) // This works, but because of above part doesnt work, it is just making  slower and slower every attempts remaining part

So I want to achieve - either reset/stop animation in order to safely set new progress value, or just set progress value and it is automatically stops all current animations.
On top of that, there is no way to check if any animation is currently ongoing without waiting progress delegate~ But its just minor issue

Using Swift 5.1 and XCode 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants