Skip to content

Instantly share code, notes, and snippets.

@kmagiera
Created March 22, 2016 15:51
Show Gist options
  • Save kmagiera/ce986276557b3f9c26f0 to your computer and use it in GitHub Desktop.
Save kmagiera/ce986276557b3f9c26f0 to your computer and use it in GitHub Desktop.
class RandomView extends React.Component {
state: any;
constructor(props) {
super(props);
this.state = {
firstValue: new Animated.Value(0),
secondValue: new Animated.Value(0),
};
}
componentDidMount() {
Animated.timing(this.state.firstValue, {toValue: 1, duration: 2000}).start();
Animated.spring(this.state.secondValue, { toValue: 100 , tension: -10 }).start();
}
render() {
return (
<Animated.View // Special animatable View
style={{
opacity: this.state.firstValue, // Binds
translateX: this.state.secondValue,
}}>
<Text>Hello</Text>
</Animated.View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment