You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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() at async resetProgressBar(), so I reset the animation by width: '0%':
functionCarousel(){// other codesconst[progressScope,progressAnimation]=useAnimate()constprogressBarController={asyncstartProgressBar(){awaitprogressAnimation(progressScope.current,{width: '100%'},{duration: 3,ease: 'linear'},)awaitprogressAnimation(progressScope.current,{width: '0%'},{duration: 0},)},asyncresetProgressBar(){// progressAnimation(progressScope.current).cancel() not working, so I reset it by the value awaitprogressAnimation(progressScope.current,{width: '0%'},{duration: 0},)},}React.useEffect(()=>{// other codeprogressBarController.startProgressBar()},[hasdependency])// other code: use progressBarController.resetProgressBar() into next/previous carousel handlerreturn(<divclassName="relative isolate grid h-36 w-sm overflow-hidden"><divclassName="z-0 grid h-36 w-sm overflow-hidden text-4xl font-bold text-slate-900 italic">{SLIDES.map((item,idx)=><motion.divkey={idx}// other codesonHoverStart={async()=>progressAnimation(progressScope.current).pause()// Doesn't work}onHoverEnd={async()=>progressAnimation(progressScope.current).play()// Doesn't work}>{item}</motion.div>}</div><motion.divref={progressScope}initial={{width: '0%'}}/></div>)}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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
Beta Was this translation helpful? Give feedback.
All reactions