From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.
in progress Inprogress50.jpg 30%
 good progresses

Working with F-Curves

Once you have created keyframes for something, you can edit their corresponding curves. In Blender 2.5, IPO Curves have been replaced by F-Curves, however, editing these curves is essentially still the same.

The concept of Interpolation

When something is "animated," it changes over time. In Blender, animating an object means changing one of its properties, such as its X location, or the Red channel value of its material diffuse color, and so on, during a certain amount of time.

As mentioned, Blender's fundamental unit of time is the "frame", which usually lasts just a fraction of a second, depending on the frame rate of the scene.

As animation is composed of incremental changes spanning multiple frames, usually these properties ARE NOT manually modified frame by frame, because:

  • it would take ages!
  • it would be very difficult to get smooth variations of the property (unless you compute mathematical functions and type a precise value for each frame, which would be crazy).

This is why nearly all direct animation is done using interpolation.

The idea is simple: you define a few Key Frames, which are multiple frames apart. Between these keyframes, the properties' values are computed (interpolated) by Blender and filled in. Thus, the animators' workload is significantly reduced.

Example of interpolation

For example, if you have:

  • a control point of value 0 at frame 0,
  • another one of value 10 at frame 25,
  • linear interpolation,

then, at frame 5 we get a value of 2.

The same goes for all intermediate frames: with just two points, you get a smooth growth from 0 to 10 along the 25 frames. Obviously, if you’d like the frame 15 to have a value of 9, you’d have to add another control point (or keyframe)…

Types of Interpolation

Despite of the name “curve”, it might be a set a linear segments, or even a set of discrete values (materialized as a “stairway curve”), depending on the interpolation mode chosen.

Direction of time

Although F-curves are very similar to Bézier curves, there are some important differences.

For obvious reasons, a property represented by a Curve cannot have more than one value at a given time, hence:

  • when you move a control point ahead of a control point that was previously ahead of the point that you are moving, the two control points switch their order in the edited curve, to avoid that the curve goes back in time
  • for the above reason, it's impossible to have a closed Ipo curve
Two control points switching: the curve can't go back in time!
Before moving the second keyframe
After moving the second keyframe


Curve Selection

By default, when you add keyframes to a channel, the Graph Editor displays them in Edit Mode. Just like in the 3D View, you can toggle the editability of a channel by pressing ⇆ Tab. In the Channel Box, the lock icon also toggles between edit and "non-edit" mode.

Selection Tools

You can select curve handles clicking LMB Template-LMB.png (or ⇧ ShiftLMB Template-LMB.png for multiple. You can select an entire key by selecting the center point, or just select one the handles

You can also (de)select all visible curves with A (or Select » Select/Deselect All), and do a border-selection with B (or Select » Border Select) – simple LMB Template-LMB.png click-and-drag to add to the selection, and RMB Template-RMB.png (or CtrlAltLMB Template-LMB.png) to remove from the selection.

Select All A
Invert Selection CtrlI
Border Select B
Border Axis Range AltB
Border (include Handles CtrlB
Columns on Selected Keys K
Column on current Frame CtrlK
Columns on selected Markers ⇧ ShiftK
Between Selected Markers AltK
Before Current Frame [
After Current Frame ]
Select More Ctrl+ NumPad
Select Less Ctrl- NumPad
Select Linked L


Editing Curves

Transformations

You can grab (G), rotate (R) and scale (S) the selected curves (those visible, with white control points/keyframes) – operations also available from the Curve » Transform sub-menu.

Additionally, for translation and scaling, you can lock the transformation along the X (time) or Y (value) axis, as usual by hitting X or Y during transformation.

You also have the classic “transform snapping” features: holding Ctrl while transforming will snap it to one-frame/one-value steps, while holding ⇧ Shift will slow down the movement, increasing its precision. Note however that using ⇧ ShiftCtrl just slows down the movement, without reducing the snapping steps.

Copying

You can copy one or more keyframes into a buffer, and then paste them into the same curves. This is done through two header buttons:

  • The “copy” CtrlC button (down arrow) copies the selected and visible curves into the buffer.
  • The “paste” CtrlV button (up arrow) pastes the buffer content into the corresponding visible curves of the current channel.

Note that this tool is not working (even though available) in “keyframe” mode. And in edit mode, only the selected points are copied/pasted (not the whole curve…).

You can also Duplicate keys through the Key menu.


Deleting

To delete a keyframe, select it (in “default” mode), and hit X (or use Curve » Delete).

Snapping

You have some “snap to” options (⇧ ShiftS or Key » Snap):

  • Current Frame - This option will move all selected keyframes to the currently active frame.
  • Cursor Value – This option will move the selected keyframes to the current position of your 2d cursor in the graph editor.
  • Nearest Frame – This will horizontally (timely) move all keyframes of the selected curves to their nearest frame (e.g. a keyframe defined at frame 23.2 will be moved at frame 23).
  • Nearest Second – This will horizontally (timely) move all slected keyframes of the selected curves to their nearest full second (e.g. a keyframe between 00:02 and 00:03 seconds will move to either 00:02 or 00:03 depending on which is nearer).
  • Nearest Marker – This will horizontally (timely) move all keyframes of the selected curves to the marker nearest to them (see also Markers).
“Flatten Handles” snapping example.
Before Flatten Handles.
After Flatten Handles.
  • Flatten Handles – This is only useful with the default F-curves: it will rotate all control points of the selected curves to set them horizontal.


Mirror

You can mirror the selected curves (⇧ ShiftM or Curve » Mirror), either Over Current Frame (i.e. the green cursor), Over Vertical Axis (i.e. frame 0), or Over Horizontal Axis (i.e. value 0.0).

Cleaning and Smoothing examples.
An unclean curve (note the two close points at the cursor).
Cleaning it (note the quite high threshold).
Now that our curve is clean…
…We can smooth it!

Cleaning and Smoothing

You can clean your selected Ipo curves, i.e. remove control points that are very close both in time and value. Hit O (or use the Curve » Clean Keyframes menu entry), set the threshold you like in the dialog that pops-up, and click on OK.

There is also an option to smooth the selected curves (AltO or Curve » Smooth Keys), but beware: its algorithm seems to be to divide by two the distance between each keyframe and the average linear value of the curve, without any setting, which gives quite a strong smoothing! Note that the first and last keys seem to be never modified by this tool.

The Transform Properties panel of curves in “default” mode.
Transform Properties panel
Yes, as in the 3D views – and also shown/hidden with N (or View » Channel Properties)! In “default” mode, it’s not much useful, as it only shows (and can edit) the X/Y minima/maxima of visible curves as a whole, hence allowing to scale up/down these curves all together.


Sample Keyframes ⇧ ShiftO

Sampling a set a keyframes replaces interpolated values with a new keyframe for each frame.

Bake Curves AltC

Baking a curve replaces it with a set of sampled points, and removes the ability to edit the curve.

Interpolation and Extrapolation

F-curves have three additional properties, which control the interpolation between points, extension behavior, and the type of handles.

Interpolation

You have three choices (T, or Curve » Interpolation Mode):
  • Constant – There is no interpolation at all. The curveconstantly have the value of its last keyframe, giving a discrete (stairway) “curve”. Very seldom useful.
  • Linear – This simple interpolation creates a straight segment between each neighbor keyframes, giving a broken line. It can be useful when using only two keyframes and the Extrapolation extend mode, to easily get an infinite straight line (i.e. a linear curve).
  • Bezier – The more powerful and useful interpolation, and the default one. It gives nicely smoothed curves, i.e. smooth animations!
Remember that some Ipo curves can only take discrete values, in which case they are always shown as if constant interpolated, whatever option you chose.
The three interpolations available for curves.
Constant.
Linear.
Bézier.


Extrapolation

Extrapolation defines the behavior of a curve before the first and after the last keyframes.

There are two basic extrapolation modes, (⇧ ShiftE, or Channel » Extrapolation Mode):

Constant
The default one, curves before their first keyframe and after their last one have a constant value (the one of these first and last keyframes).
Linear
Curves ends are straight lines (linear), as defined by their first two keyframes (respectively their last two keyframes).


The two extensions available for Ipo curves.
Constant.
Extrapolation.


Additional extrapolation tools are located in the F-Curve Modifiers

Handle Types

There is another curve option quite useful for Bézier-interpolated curves. You can set the type of handle to use for the curve points V

Automatic
Vector
Aligned
Free
Auto Clamped


Unclamped
Clamped