Skip to content

Instantly share code, notes, and snippets.

@tuor4eg
Created January 22, 2019 21:05
Show Gist options
  • Save tuor4eg/37203741f189aa555c9ac22d94d61d38 to your computer and use it in GitHub Desktop.
Save tuor4eg/37203741f189aa555c9ac22d94d61d38 to your computer and use it in GitHub Desktop.
runIntroAnimation = async () => {
await this.setState({
timer: this.state.timer + 1.5,
scaleA: new Animated.Value(1),
opacityA: new Animated.Value(1),
scaleB: new Animated.Value(1),
opacityB: new Animated.Value(1)
});
let { scaleA, scaleB, opacityA, opacityB } = this.state;
Animated.stagger(500, [
Animated.parallel([
Animated.timing(opacityA, {
toValue: 0.25,
duration: 750
}),
Animated.timing(scaleA, {
toValue: 1.5,
duration: 750
})
]),
Animated.parallel([
Animated.timing(opacityB, {
toValue: 0.25,
duration: 750
}),
Animated.timing(scaleB, {
toValue: 1.5,
duration: 750
})
])
]).start(() =>
this.state.timer >= 3 ? this.props.done() : this.runIntroAnimation()
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment