[英]How Do I Delay a Bodymovin Animation
Ok so I just started using bodymovin and was wondering if there was a way for me to delay the animation. 好的,所以我刚开始使用bodymovin,想知道是否有办法延迟动画。
My web page fades in so during that fade in the animation is happening which is not what i would like. 我的网页淡入淡出,因此在动画淡入淡出的过程中,这不是我想要的。 So if I could delay it by 2 seconds that would be great.
因此,如果我可以将其延迟2秒,那就太好了。
Here is my code: 这是我的代码:
var animation = bodymovin.loadAnimation({
container: document.getElementById('bm'),
renderer: 'svg',
loop: false,
autoplay: true,
path: 'data.json'
})
I have tried to use setTimeout but I have not been able to get it to work. 我尝试使用setTimeout,但无法使其正常工作。
You could set the autoplay
value to false
, and call play()
in a timeout of 2000ms. 您可以将
autoplay
值设置为false
,并在2000ms的超时时间内调用play()
。 I'm assuming you're using the library found here . 我假设您正在使用此处找到的库。
var animation = bodymovin.loadAnimation({
container: document.getElementById('bm'),
renderer: 'svg',
loop: false,
autoplay: false,
path: 'data.json'
})
setTimeout(function(){ animation.play(); }, 2000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.