3
アニメーションは、image01.png
、image02.png
、image03.png
などのシーケンスで構成されています。これらをReact Nativeでアニメーション化する方法を教えてください。あなたが図書館で試すことができReact Nativeのアニメーションシーケンスをアニメ化する
アニメーションは、image01.png
、image02.png
、image03.png
などのシーケンスで構成されています。これらをReact Nativeでアニメーション化する方法を教えてください。あなたが図書館で試すことができReact Nativeのアニメーションシーケンスをアニメ化する
:
まず第二は、純粋なJavaScriptであり、より効率的です。もう一つの方法は、ここのように、独自の方法でそれを実装することです:https://github.com/facebook/react-native/issues/9280
それはあなたがアニメーションとレイアウトアニメーションが反応し、ネイティブには提供してチェックアウトすることができ、この
export default class Animation extends Component {
constructor(props) {
super(props);
this.images = [
require('./img_01.png'),
require('./img_02.png'),
require('./img_03.png'),
];
this.next = this.next.bind(this);
this.state = {index: 0};
}
componentDidMount() {
this.next();
}
next() {
setTimeout(() => {
this.setState({index: (this.state.index+1)%3});
this.next();
}, 300);
}
render() {
return (
<Image
source={this.images[this.state.index]}
style={styles.image}
/>
)
}
}
のように見えるはずです。 –