Skip to content

Instantly share code, notes, and snippets.

@abdurrahmanekr
Forked from dabit3/Animated.sequence()
Last active June 11, 2017 12:35
Show Gist options
  • Save abdurrahmanekr/799a4527ff2aa4848ac7b86841c57fa6 to your computer and use it in GitHub Desktop.
Save abdurrahmanekr/799a4527ff2aa4848ac7b86841c57fa6 to your computer and use it in GitHub Desktop.
javascript,react-native,animation,animated
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Animated
} from 'react-native'
const dizi = []
for (var i = 0; i < 500; i++) {
dizi.push(i)
}
class test extends Component {
constructor () {
super()
this.animasyonDegeri = []
dizi.forEach((value) => {
this.animasyonDegeri[value] = new Animated.Value(0)
})
}
componentDidMount () {
this.animate()
}
animate () {
const animasyonlar = dizi.map((item) => {
return Animated.timing(
this.animasyonDegeri[item],
{
toValue: 1,
duration: 50
}
)
})
Animated.sequence(animasyonlar).start()
}
render () {
const animasyonlar = dizi.map((a, i) => {
return <Animated.View key={i} style={{opacity: this.animasyonDegeri[a], height: 20, width: 20, backgroundColor: 'red', marginLeft: 3, marginTop: 3}} />
})
return (
<View style={styles.container}>
{animasyonlar}
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'row',
flexWrap: 'wrap'
}
})
AppRegistry.registerComponent('test', () => test);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment