【发布时间】:2020-07-13 10:12:04
【问题描述】:
我想使用 react native 制作门动画,但我不知道具体该怎么做,
我只是可以像这样动画翻转卡过渡:
谁能帮我制作门动画?
Current code:
export default class Home2 extends React.Component{
constructor(props) {
super(props);
this.anim = new Animated.Value(0)
}
startAnim(){
this.anim.setValue(0)
Animated.spring(this.anim, {
toValue:1,
useNativeDriver:false
}).start()
}
render() {
const animated = this.anim.interpolate({
inputRange:[0, 1],
outputRange:['80deg', '0deg']
})
return(
<View style={{flex:1, justifyContent:'center', alignItems:'center', backgroundColor:'red'}}>
<Animated.View style={{width:100, height:100, backgroundColor:'white', transform:[{rotateY:animated}]}}/>
<Button
onPress={() => {
this.startAnim()
}}
title="Start"
/>
</View>
)
}
}
【问题讨论】:
-
有什么建议吗?
标签: css react-native animation