Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Stopping current animation and adding another one? #19

Closed
msalihkocak opened this issue Mar 2, 2017 · 1 comment
Closed

Stopping current animation and adding another one? #19

msalihkocak opened this issue Mar 2, 2017 · 1 comment

Comments

@msalihkocak
Copy link

msalihkocak commented Mar 2, 2017

Hello Luis,

I am developing a speedtest app and using the framework for showing countdown for a download period. By default it is planned to be animating 10 seconds like:
self.uploadCircle.setProgress(value: 100, animationDuration: 10.0)
but sometimes download finishes earlier than 10 seconds. In those cases i want to stop the 10 second animation and immediately make it %100 percent. I tried several ways like:

func downloadTimerInvalidator () {

    if let downReq = self.downloadRequest{
        downReq.cancel()
    }
    DispatchQueue.main.async {
        self.downloadCircle.setProgress(value: 100, animationDuration: 0.1)
    }
}

but it didn't work. It is like ignoring this line and having the full 10 sec cycle. Any help is appreciated. Thanks.

luispadron pushed a commit that referenced this issue Mar 2, 2017
- Add a property for accessing the current value of the progress ring while animating, closes [issue #14](#14)
- Add fix for removing a currently running animation when calling `setProgress(:)` while ring is animating, closes [issue #19](#19)
- Fixed access levels for variables and functions, changed from `public` to `open` to allow subclassing.
- Updated `docs` by running Jazzy
@luispadron
Copy link
Owner

Fixed this issue in version 1.3.0

Whenever calling setProgress(:) while ring is animating, the current animation will be canceled and a new one will be started this should fix your issue!

Also, you can call self.downloadCircle.setProgress(value: 100, animationDuration: 0.1) with an animation duration of 0, which will cause no animation to occur and will instantly be set to that value.

Thanks for posting your issue, if you have any more questions feel free to update or read the docs here

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

No branches or pull requests

2 participants