Blender 3D: Noob to Pro/Basic Animation/Introduction to Keyframing

From Wikibooks, open books for an open world
Jump to navigation Jump to search

In this module, you will learn the basics of how to insert and remove keyframes, and preview the resulting animation in the 3D view.

First Keyframes[edit | edit source]

Start by opening a new Blender document. Select the default cube. Ensure that the timeline is showing that you are at frame number 1. Press  I , and choose “Location”; this will insert a keyframe at frame 1 which remembers the current location of the cube. Move the current frame (green line) away from frame 1, and you will see that there is a yellow line left behind.

Now go to, say, frame 25. With the cube still selected, press  G , and move the cube to a different position—anywhere a few cube widths away will do fine. Press  I  again, and insert another Location keyframe.

Now try scrubbing with  LMB  between the two yellow lines in the timeline, and watch the cube move smoothly between the two positions you set as keyframes.

Now press  ALT + A , and Blender will automatically cycle through the timeline for you, animating the cube as it goes. There will probably be a long pause in the motion after it gets to frame 25, because by default the animation will run until frame 250. Press  ESC  to stop the animation, click in the box at the bottom of the timeline labelled “End:”, and reduce the end frame number to, say, 50. Press  ALT + A  to start the animation again, and watch the movement cycle through a little more quickly this time.

Stop the animation, go back to frame 1, and press  ALT + I  to delete that first keyframe. Move the current time away from frame 1, and confirm that the yellow line that was there has gone. Now restart the animation; what happens? You should see the cube snap to the location specified by the only remaining keyframe, and stay there. Without a second keyframe specifying a different value for a parameter, Blender sees no reason to change the value for that parameter to anything else. Hence the rule:

Note:

A parameter is only animated at a particular time if there are keyframes before and after that time specifying different values for that parameter.

Preview From All Angles[edit | edit source]

Press  ESC  to ensure the animation is stopped, then  CTRL + Z  to undo your deletion of the first keyframe above. Press  ALT + A  to start the cube moving between its two positions again. While it runs, the 3D View window remains fully operational; try using  MMB  to rotate the view, the mouse wheel to zoom in and out,  NUM0  to toggle in and out of camera view, etc. All the while, the cube keeps running through the dance you choreographed for it. How neat is that?

What Is Being Animated?[edit | edit source]

Those yellow lines in the timeline aren’t really very informative. They tell you there is a keyframe at that time, but not what settings are being specified. And there is no way to adjust an already-inserted keyframe, you have to delete it and insert another one.

All this fine control (and much more) is possible elsewhere, in the Graph Editor window, but we’ll leave that for later. For now, just bring up the Properties Shelf in the 3D View by pressing  N  (if it’s not already visible). At the top of this is the “Transform” panel, where you can see location/rotation/scaling settings for the currently-selected object. Notice that the Location values for the cube are displayed against a coloured background, either green or yellow; move the current frame time to a keyframe time, and it will be yellow, otherwise it will be green.

This coloured background is your cue that the specified value is being animated, and whether the current animation time is a keyframe time for that value. This goes for animating other properties as well, not just object transformations.

Animating a Material Property[edit | edit source]

Think of this next example as a teaser. It will be left incomplete for now, because to see the full effect you will need to put a bit more work into material, lighting and render settings, and render out the full sequence for viewing in some kind of external movie player. Feel free to come back and fill in the gaps as you learn more about those things.

One of the goals in the Blender 2.5x rework was to introduce the concept of being able to “animate anything”. Animation had been a bit of an afterthought in earlier versions of Blender, but in 2.5x it is integrated very deeply, to the point where just about any object property can be animated over time.

Start a new Blender document. Select the default cube, and create a new material for it. You don’t need to change the colour or any of the other settings for it, but look in the material settings for the “Transparency” panel and check the title box.

Look in that panel for the “Alpha:” slider (which might be abbreviated to something like “Alp”, depending on the size of your screen). It should be showing the default value of 1.000 (fully opaque). Right-click on it ( RMB ) to bring up a menu with a bunch of options, of which the one we want is the top one, “Insert Keyframe”. Once you select this, the background of the Alpha slider should turn yellow.

Set the current frame to another point, say frame 25. As you move away from frame 1, the background of the Alpha slider turns green, indicating it is being animated, but is not currently at a keyframe. At frame 25, set the Alpha value to zero, or fully invisible (by either dragging across it with  LMB  or clicking in it and typing the new value). Then right-click on it and insert another keyframe.

Now try scrubbing back and forth in the timeline between frame 1 and frame 25, and you should see the Alpha value change accordingly between the two key values you specified. If you look in the preview image at the top of the material properties window, you should see the sample object there correspondingly fade in and out. Unfortunately the actual cube in the 3D view won’t do this ("Solid" Viewport), but it will when you set the Viewport to "Material". If you were to render the image at the current frame with  F12 , you should see the cube appear with varying degrees of faintness, down to becoming completely invisible at the end.

In short, you now have an animated disappearing cube.