我试图把下面的动画无限循环,直到发生特定的状态:在这里循环播放本地反应动画动画
class MyModal extends Component {
constructor() {
super()
this.springValue = new Animated.Value(0.3)
}
spring =() => {
this.springValue.setValue(0.3)
Animated.spring(
this.springValue,
{
toValue: 1,
friction: 1,
tension: 1,
duration:5000
}
).start()
}
componentDidMount() {
this.spring()
}
render() {
return (
<View>
<Modal
animationType="none"
transparent={false}
visible={this.state.modalVisible}
onRequestClose={() => null}
>
<View style={styles.backgroundStyle}>
<Animated.Image
source={require("./my-awesome-image.png")}
style={{ width: 143, height: 125, top: 100, transform: [{scale: this.springValue}]}}
/>
</View>
</Modal>
</View>
);
}
}
一切的伟大工程,在动画完成一次(因为我不是循环任何地方)。
如何保持我的Animated.Image
循环,直到达到特定状态?我只是想要它无限循环,并且能够在我准备好时停止动画或开始另一个动画。