我想在屏幕上制作一系列动画,其中一秒会无限循环。我有一个问题,正确调用它们。我试图从componentDidmount中删除.start()并执行.start((()=> this.animate2),但它弄乱了整个动画。我无法弄清楚如何正确地做到这一点。动画的循环序列
在此先感谢!
为了简化它看起来像这样的代码:
animate1(){Animated.sequence([...])}
animate2(){Animated.sequence([...])}
在componentDidmount我叫他们两个:
componentDidMount() {
Animated.sequence([
this.animate1(),
Animated.delay(3000),
this.animate2()
]).start();
我试过这样做,但问题是,然后animate2()几乎立即开始动画,不尊重componentDidMount()中的顺序。此外,在函数运行一次后,我得到一个错误:undefined不是一个对象(评估'动画[current] .start') – misi06