geoffreydhuyvetters / animate-value

🏃 animates a numeric value
MIT License
12 stars 2 forks source link

Stop/pause an animation? #7

Open drewbaker opened 2 years ago

drewbaker commented 2 years ago

This really seems to be the best library around to animate values, which in a Vue world, is actually really handy. Being able to animate values in JS and use the Vue templates to update the DOM is awesome.

But, I'd love to be able to cancel an animation once it has started. Perhaps like this?

const animation = av({
                from: 0,
                to: 100,
                duration: 10000,
                done: () => {
                    // Done
                },
            })

setTimeout(()=>{
     animation.pause()            
}, 500)