Replies: 1 comment
|
The So the animation you need to control is the one you already started with const runningAnimation = useRef<ReturnType<typeof progressAnimation> | null>(null)
const progressBarController = {
async startProgressBar() {
const controls = progressAnimation(
progressScope.current,
{ width: '100%' },
{ duration: 3, ease: 'linear' },
)
runningAnimation.current = controls
await controls
progressAnimation(progressScope.current, { width: '0%' }, { duration: 0 })
},
pause() {
runningAnimation.current?.pause()
},
resume() {
runningAnimation.current?.play()
},
}Call |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi
I don't know the usage of controller is correct or not, because it's not working.
I want when hover over each item the current width animation pause and when hover out continue the animation, also I couldn't use
progressAnimation(progressScope.current).cancel()atasync resetProgressBar(), so I reset the animation bywidth: '0%':Thank you in advance
All reactions