Create and combine multiple animation tracks on an object.
- [Narrator] Animation layers let us create many different independent sets of key frames for parameters such as object position. We can mix and match these collections of key frames in interesting and useful ways. Animation layers let us easily create multiple versions or takes of a single animation in the same scene files. We can also stack animation data, combining the effects of multiple sets of key frames to create what is known as, quote, layered, unquote, animation.
We can layer animation over other animation on the same parameter. We can also layer animation from different parameters to create compound motion. In this example, we will create separate animation takes on the X axis, or the side to side movement of the bouncing ball and combine that with Z axis animation for the elevation of the ball, and we'll place all of those on separate animation layers so that we can enable or disable them at will.
Animation layers are on a toolbar that can be accessed from the animation menu. Choose animation, animation layers. If nothing is selected, then most of the icons will be grayed out. We're going to add animation to the ball helper object which is the green cross. Select that in the top U-port and then on the left of the animation layer's toolbar, the enable anim layers button is now available. When we click this button, we get a dialog box in which we can choose to enable animation layers for various object parameters.
When you add an animation layer, you're adding a controller called the layer controller, and it's very similar to the list controller, allowing us to combine and even wait the influence of multiple controllers. The difference with layers is that you can only add the layer controller through this dialog. You can't add a layer controller in the usual way through the motion panel or a track view. In this case, I'm only going to be animating the position of this object, so I'll disable everything except for position.
As an aside, it's important for you to know that, although you can apply animation layers onto any parameter of an object, that parameter must already have a controller assigned to it before you get to this point. Common parameters such as the transforms of position, rotation, and scale always have animation controllers assigned at object creation time, but many of these other parameters such as object parameters, modifiers, materials and so on, do not have animation controllers assigned to them by default.
For a position track, though, I know it already has a controller on it, so I can just click okay. Up here in the animation layers toolbar, we see something labeled base layer and this is the currently active layer. Whenever we create an animation layer controller, we get a base layer to start with, and that base layer could have animation in it, but currently, this one does not. It simply has the position offset of the ball helper object away from the origin and when to leave it that way, I'm going to use that as an offset so I can later control the ball position without changing the animation.
So I want to create another layer to hold the actual animation and that's done by clicking on the add anim layer button. Get the create new animation layer dialog in which we can give it a name. Let's call it position X one. Now that layer is created. The name of the active layer is displayed in a pull-down list here. If I click on that, I can choose either of the two layers, base layer or position X one. I want to add key frames to position X one.
With it as the active layer, I'll grab the move tool, go down to the end of the timeline, enable autokey, and in the top view, move the ball helper object in the positive X direction and observe the results in the camera view and just move the ball out of the frame. Release the mouse, disable autokey, rewind and play that back, and we have a slow in, slow out motion.
Let's correct that. I want a linear motion. Stop the timeline and rewind. Open up the curve editor from its button on the main toolbar. And over here, we've got the track list and in my case, I've got X, Y, and Z position already selected within the position X one layer. If those aren't selected for you, just make sure that you've got all of those selected and then frame those curves in the graph. Click on the button labeled frame horizontal and value extends, and we want to make all of these key frames linear.
Drag a rectangle around all of those keys, and then on the curve editor toolbar, click the button to set tangents to linear. We've done that for all of the position tracks including Y and Z. Strictly speaking, Y and Z are not important here and we could just delete those key frames, but we'll leave them here now to demonstrate that since they have values of zero, they're not adding or subtracting anything to the animation.
I wanted to make them all linear tangents so that we would not have issues with the time slider down here later. All of those key frames are grouped together and we can select them all at once in the timeline. That has just been a little bit of detour into cleaning up the animation itself. Let's close the curve editor, rewind and play that back, and now we've got linear motion and we're ready to make a duplicate of this layer. Go back to frame zero and with position X one, the active layer, copy its contents into the clipboard.
Click the copy anim layer button, and then we can paste the contents of the clipboard into a new layer with this button, paste new layer. We want to give this new layer a name. We'll call position X two. Now that we've duplicated that animation layer and they're both enabled, if we press the play button, we'll see the ball move twice as far. We literally have double transformations here. Let's rewind that, and we want to reverse the screen direction for one of these takes.
Let's disable the one we're not working on. Go up to the pull-down list and click on it, and once this pull-down list is open, then you can click on the icon buttons over here to change the properties. On the left is a light bulb icon to enable or disable that animation layer. Click the light bulb next to position X one to disable that layer, and then click position X two to make that layer active. The key frames displayed in the timeline here are for position X two.
We want to reverse these key frames' direction, so let's click in the timeline to make sure nothing is selected first, and then click on the key frame at frame zero and drag it down. Click on the key frame at frame 40 and move it to frame zero and then finally move this one down to frame 40. We've reverse the direction. Rewind and play that back. The ball is now moving from right to left. So we have two different takes. Position X one is moving left to right.
Position X two is moving right to left. Let's re-enable position X one. Go back into that pull-down list. Enable the light bulb for position X one and disable it for position X two and now, the ball's going to move in the left to right direction once again. Revisiting this pull-down list, the other items we have over here are worth mentioning. We have the ability to lock the key frames on a layer with this padlock icon.
We also have the ability to enable or disable that layer for the output track. That's what this plus sign is over here. The output track is an animation channel that works independently of the final output of the layers. You can use the output track to drive other tracks in the scene, regardless of which of these layers are enabled. If the plus sign is on, then that layer's data is added to the output track even if the light bulb to enable the layer is turned off.
We can see this in the curve editor. I'll reopen the curve editor and we have down here the output track. Open that up and choose the X axis and over here, we can make some changes. Currently, if the position X one and two are enabled, they're canceling each other out and we get a flat line to the output, but we can change this up. If I click the plus sign next to position X two, that turns it off for the purposes of this special output track.
Now, if we go over to the curve editor, click there, and then middle mouse to navigate, we can see that position X two is disabled and we're getting motion from the negative to the positive direction in X. We can go back up here and reverse these. We can turn position X one off in the output track and turn position X two on for the output track, and now we see the position going from positive X to negative X.
I'm going in the opposite direction from right to left in ScreenSpace. This is just a little extra bonus. This output track allows us to create a separate mix. Then we can drive other tracks in the scene regardless of which layers are enabled. We don't need the output track feature for this simple example, but it might come in handy in complex scenarios in combination with wire parameters. For now, I'll just turn them all back on again and now we can add another animation layer for position in Z.
Go back to our animation layers toolbar, and once again, click add anim layer again and we'll rename this position Z. The new animation layer is made the current layer and now we can create some key frames on that current layer. Close the curve editor again, and it's easiest to do this in set key mode rather than auto key. Let's go into our key filters and we only want to create keys for positions, so turn all of the other filter options off except for position.
Close the set key filters dialog, enable set key mode, and on frame zero, we want a Z position with the ball off the ground, so click the plus sign to create a key for position on frame zero. Then go down to the middle of the animation. Let's make it frame 15, and we want to create a key frame with the ball touching the ground. Grab the move tool in the front view port and move that ball down until it's touching the ground in the camera view.
Release the mouse, press the plus sign to create a key frame and we can scrub across to see that indeed, we're layering animation now and we just want a few more key frames with the ball resting on the ground. I'll go down to frame 25, press the set keys button, the big plus sign. That creates a key frame with the ball resting on the ground. Go down to frame 31, create another key frame. Let's do 36, and also frame 40. I've got a few key frames at the end here where the ball is just touching the ground and if we turn off set key and rewind, we see the ball glide across the ground, but we're going to edit this in the curve editor to create some bounces.
Rewind the animation. Once again, go into the curve editor and in the position Z layer, choose the Z position track and then frame horizontal and value extends. Select all of the key frames and break their tangent handles. Click the button break tangents and then we can start to edit these to create some interesting bounces. We can zoom in and out with control, alt, and middle mouse, up and down and side to side and then position with the middle mouse.
Use a left mouse button to edit these curves and we'll create an interesting little bounce sequence here. Okay, I've done a quick edit to the Z axis position. We can dolly back. So I've got a few bounces there. We can close the curve editor now. Rewind and play this back and we can see that we are indeed layering the position X one and the position Z animations. Let's switch this up now.
We'll go over here to the animation layers toolbar and turn off position X one and turn on position X two, which is the ball moving from right to left and then rewind, play back, and our position Z animation is exactly the same, but our position X animation is reversed. That's how we can use animation layers to create different takes and to combine animation to create compound motion.