Animating with the Channel Editor > Expressions > Working with Expressions in the Channel Editor >

# Cascading Expressions

You can copy a single expression to multiple channels that build on the result in the previous channel using the SelectionOrder and CascadeChannel keywords. These keywords increment the channel number or name as follows:

- Each instance of SelectionOrder increments the channel number.
- Each instance of CascadeChannel replaces the occurrence of the channel name with the name of the preceding channel, relative to the order in which the channels are selected.

In general, experiment with the SelectionOrder and CascadeChannel keywords to determine which results are optimal for your animation.

To apply cascading expressions using SelectionOrder:

1. Click Animation to display the Animation controls.
2. From the Channel View box, select Info.
3. Select multiple channels to which you want to apply the cascaded expression, in the desired order.

   As you select each channel, the selection order is shown next to the channel name in Info view.

   TipTo select a range of channels, click the first channel that you want to include in the range. Then click the last channel to include in the range while holding Shift. To add to a range of files, hold Ctrl or the stylus button while selecting the channels from the Channel Editor.
4. Enter an expression that includes the keyword SelectionOrder.

   Every instance of the keyword SelectionOrder will be substituted in your expression by a different number for each channel, which corresponds to the order in which you selected them.

To animate four channels using SelectionOrder:

1. In Action, add four axes named axis1, axis2, axis3 and axis4.
2. Animate axis1.position by creating a few keyframes.
3. Select the channels axis2.position, axis3.position and axis4.position in this order.
4. Enter the following expression: eval(axis1.position, frame - 5 * SelectionOrder).

   The following expressions are applied:

   - axis1.position: no expression
   - axis2.position: eval(axis1.position, frame - 5 * 1)
   - axis3.position: eval(axis1.position, frame - 5 * 2)
   - axis4.position: eval(axis1.position, frame - 5 * 3)

To apply cascading expressions using CascadeChannel:

1. Click Animation to display the Animation controls.
2. From the Channel View box, select Info.
3. Apply an expression to a base channel to which the other channels will relate.
4. Select multiple channels, starting with the base channel, to which you want to apply the cascaded expression, in the desired order.
5. Enter an expression that includes the keyword CascadeChannel.

   The base channel (the first channel selected) will remain unmodified. In the expressions for the other selected channels, every instance of the keyword CascadeChannel will be substituted by the name of the channel that preceded it, in the order in which you selected them.

To animate four axes using CascadeChannel:

1. In Action, add four axes named axis1, axis2, axis3 and axis4.
2. Animate axis1.position by creating a few keyframes.
3. Select, in this order, the channels axis1.position, axis2.position, axis3.position and axis4.position.
4. Enter the following expression: eval(CascadeChannel, frame - 5).

   The following are applied:

   - axis1.position: no expression
   - axis2.position: eval(axis1.position, frame - 5)
   - axis3.position: eval(axis2.position, frame - 5)
   - axis4.position: eval(axis3.position, frame - 5)
   NoteThis results in the same animation as the SelectionOrder example given above.