rive-react icon indicating copy to clipboard operation
rive-react copied to clipboard

rive animation first time load failed

Open ninibear030 opened this issue 2 years ago • 1 comments

Hi guys, i am using next 13 with "@rive-app/react-canvas": "^4.8.1" and this is my code

  const { RiveComponent, rive } = useRive({
    src: "xxxx.riv",
    stateMachines: STATE_MACHINE_NAME,
    artboard: "xxxx",
    autoplay: true,
    layout: new Layout({ fit: Fit.Contain }),
  }); 

sometimes the animation cant autoplay properly, (it looks broken like how it look in rive app before start the animation) its like 25% chance this will happened and i cant find a way to detect it.

i tried below it also doesnt work

autoplay: false
useEffect(()=>{ if(rive) rive.play()},[])
or
useEffect(()=>{ if(rive) rive.play()},[rive])


ninibear030 avatar Feb 21 '24 16:02 ninibear030

plss help ;-;

ninibear030 avatar Feb 21 '24 16:02 ninibear030