Advanced workflow: Use constraints and expressions with animation layers
 
 
 

You can use animation layers with constraints and expressions to drive objects in your scene. For information on adding constraints to animation layers, see Add constraints to animation layers.

Note that the workflow for adding expressions to animation layers is more complex and includes some known limitations. (See Known limitations for animation layers with constraints and expressions.)

To set up an expression to drive an object with layered animation, you must locate the layer’s blend node that corresponds to the attribute you want to be driven. You then set up the constraint or expression to drive the inputB attribute of that blend node.

This example describes how to add an expression to the translateY attribute of an object with layered animation.

To create an expression that drives layered animation

  1. Create a new scene and add any object you want to animate with an expression. This example describes animating a sphere.
  2. In the Animation Layer Editor, click to create an empty layer. The new layer is called AnimLayer1 by default.

    The next steps describe how to add an expression to AnimLayer1 in order to drive the sphere’s translateY attribute.

  3. Do the following to locate the blend node to which you will connect your expression:
  4. Open the Expression editor (Window > Animation Editors > Expression Editor), select inputB in the Attributes area.
  5. In the Expression Editor, write the expression that will drive the inputB of the blend node. (See Creating animation expressions.)

    The expression you write for the inputB attribute now drives the sphere’s translateY animation on AnimLayer1.

    For example, to add a sine function that drives the sphere’s translateY value, enter the following:

    pSphere1.translateY = sin(time);

    This expression makes the sphere move up and down following a sine wave that varies with time.

Related topics

Known limitations for animation layers with constraints and expressions

Note the following known limitations and workarounds when using animation layers with constraints or expressions.