In this lesson we'll use
Animated.sequence to play multiple
Animated.spring animations one after another.
We'll start by importing Animated from React Native. Then we'll create our componentWillMount life cycle method. We'll start with two animated values. We'll create them at this.animated (value1) equals a new animated value with a default value of 0. This.animated(value2) and we'll create animated value and assign a default value of 1.
Then we'll create a variable called animatedstyle, assign it an object with the property of transform, which is an array, which takes a series of objects. Our first transform object will translate y, which we'll give it this.animated(value1). Our second will be scale, which we'll give this.animated(value2). Then we'll change our regular view to an animated view and then apply our new animated style to that view.
Now we'll create a componentToMount life cycle method. We'll use animated.sequence, which is a function that takes an array. Then we'll create an animated.timing and pass in this.animated(value1). We'll animate to 150 over the course of a thousand milliseconds.
Then we'll create an animated.spring and pass on this.animated(value2) and animate to 3. Then we'll create another animated.timing and animate this.animated(value1) back to 0, over another thousand milliseconds. Then animate another animated.spring on this.animated(value2) to 0.5. Then we'll call start on our sequence, refresh our emulator, and see that each animation played one after the other.