Repeat animation with new animated api

后端 未结 8 1007
时光取名叫无心
时光取名叫无心 2021-01-31 14:40

React-native introduce new Animated API, I want to make a loop animation such as a bubble scale up then scale down and repeat that progress.

However I can n

8条回答
  •  灰色年华
    2021-01-31 15:10

    It seems that 'looping' is not supported by the Animated api for now.

    I managed to do that by start the animation again when it finished.

    startAnimation() {
      Animated.timing(this._animatedValue, {
        toValue: 100,
        duration: 1000,
      }).start(() => {
        this.startAnimation();
      });
    }
    

    Looking forward to a better solution...

提交回复
热议问题