你好,我正在尝试使用Animatable在React Native中制作旋转轮。遵循这个例子(https://code.tutsplus.com/tutorials/practical-animations-in-react-native--cms-27567),我能够旋转一个矩形框。以下是代码!
但问题在于我们正在旋转一个使用CSS创建的盒子,是否有一种方法可以使用HTML和CSS创建自己的旋转器,并根据业务规则旋转并停止它?
<Animatable.View
ref={animation[0]}
style={[styles.box, { backgroundColor: animation[1] }]}
animation={animation[0]}
iterationCount={"infinite"}>
<Text style={styles.box_text}>{animation[0]}</Text>
</Animatable.View>
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
padding: 20
},
row: {
flex: 1,
flexDirection: 'row',
justifyContent: 'space-between'
},
box: {
alignItems: 'center',
justifyContent: 'center',
height: 100,
width: 100,
backgroundColor: '#ccc'
},
box_text: {
color: '#FFF'
}
});
但问题在于我们正在旋转一个使用CSS创建的盒子,是否有一种方法可以使用HTML和CSS创建自己的旋转器,并根据业务规则旋转并停止它?
需要一些指导和建议,谢谢!