crisbeto / angular-svg-round-progressbar

Angular module that uses SVG to create a circular progressbar
https://crisbeto.github.io/angular-svg-round-progressbar/
MIT License
742 stars 173 forks source link

Restarting the animation #45

Open mokargas opened 8 years ago

mokargas commented 8 years ago

This is more a question than an issue.

I have a use case where I need to re-animate the progress bar to show the user's current progress from zero. The actual current value may or may not have changed, but for the UX, I need to re-display where they are. How would I re-run the animation?

Also, is it possible to programatically decide when to start, stop and restart the animation from my controller? Consider if showing the progress bar is dependent on some part of an app animating - if it exists in the page already, the user won't see the animation.

crisbeto commented 8 years ago

In both cases, you can programatically determine the current value that is being passed to the progressbar by passing a function to current, instead of the value itself. For example:

<div round-progress current="getCurrent()"></div>
$scope.getCurrent = function() {
    if (whatever) {
        return 0;
    }
    return $scope.current;
}
partialdata commented 8 years ago

@mokargas Where you able to implement start, stop, and resume by using the getCurrent function? I am having trouble figure out how to implementing this. I can see the value in the log. I am just stumped on how to pause that value from getCurrent then use that value to resume...