0
I am using the Lottie library in React Activate and want to animate an object and after 2.5 seconds pause the animation, but settTimeOut returns me an error. The command anim.pause()
works properly out of setTimeOut.
Declaration of animation:
<LottieView
ref={(animation) => {
anim = animation;}}
style={{width: wh * 10, height: wh * 10}}
source={send}
/>
Picking up the Lottie component reference:
let anim = useRef(null);
Where I call the function:
function Send(){
anim.play();
setTimeout(() => { anim.pause() }, 2500);
}
The error: Typeerror: null is not Object (evaluating 'anim.pause')
Can someone help me with that?