react-native
API d'animation
Recherche…
Animer une image
class AnimatedImage extends Component {
constructor(props){
super(props)
this.state = {
logoMarginTop: new Animated.Value(200)
}
}
componentDidMount(){
Animated.timing(
this.state.logoMarginTop,
{ toValue: 100 }
).start()
}
render () {
return (
<View>
<Animated.Image source={require('../images/Logo.png')} style={[baseStyles.logo, {
marginTop: this.state.logoMarginTop
}]} />
</View>
)
}
}
Cet exemple anime la position de l'image en modifiant la marge.
Modified text is an extract of the original Stack Overflow Documentation
Sous licence CC BY-SA 3.0
Non affilié à Stack Overflow