Dive into this comprehensive After Effects tutorial and learn how to loop an animation with expressions, work with essential properties, and add motion blur to a nested composition for a more dynamic and fluid animation.
This exercise is excerpted from Noble Desktop’s Adobe After Effects training materials and is compatible with After Effects updates through 2023. To learn current skills in After Effects with hands-on training, check out our After Effects Bootcamp, Motion Graphics Certificate, and motion graphics design classes in-person and live online.
Note: These materials are provided to give prospective students a sense of how we structure our class exercises and supplementary materials. During the course, you will get access to the accompanying class files, live instructor demonstrations, and hands-on instruction.
Topics covered in this After Effects tutorial:
Looping an Animation with Expressions, Working with Essential Properties, Adding Motion Blur to a Nested Comp
Exercise Preview
Exercise Overview
In this exercise you’ll finish animating the medical illustration as you learn about motion paths, and using an expression to loop an animation.
Getting Started
-
You should still have Your Name - Medical Animation.aep open in After Effects. If you closed it, re-open it now by going to File > Open Project then Desktop > Class Files > After Effects Class > Medical Animation. We recommend you finish the previous exercise (5C) before starting this one. If you haven’t finished it, do the following sidebar.
If You Did Not Do the Previous Exercise (5C)
- If a project is open in After Effects, go to File > Save, then File > Close Project.
- Go to File > Open Project and navigate to Desktop > Class Files > After Effects Class > Medical Animation > Finished Projects.
- Double–click on Medical Animation - Ready for Expressions.aep.
- Go to File > Save As > Save As. Name the file Your Name - Medical Animation.aep and save it to Desktop > Class Files > After Effects Class > Medical Animation (replacing the file if it’s already there).
Looping an Animation with Expressions
After Effects has a scripting language named Expressions. Scripting can be used on the Timeline to enhance your animation and optimize some repetitive tasks. In this section, we will add an expression to the Position property to loop the keyframes.
- In the Timeline, select the blood cell 1 layer.
Hold Option (Mac) or Alt (Windows) and click on the Position stopwatch to add an expression.
-
In the expression text field that appears below the keyframes, replace the default text (transform.position) with the following:
loopOut("cycle");
NOTE: Expressions are case–sensitive so type it exactly as shown above!
Click anywhere outside of the text field to finalize the expression.
Move the playhead to 6;00
Press the N key to move the end of the work area bar to the current playhead position.
Use the Spacebar to preview the animation. Notice that the animation now repeats every 2 seconds.
Choose File > Save or hit Cmd–S (Mac) or Ctrl–S (Windows).
Duplicating & Offsetting Layers
To create more blood cells, we’ll pre–comp the animated layer to turn it into a nested composition.
In the Timeline, Ctrl–click (Mac) or Right–click (Windows) on the blood cell 1 layer and choose Pre–compose.
-
Set the following:
- Name it blood cell - animated
- Check on Move all attributes into the new composition.
- Make sure the other options are NOT checked.
- Click OK.
- Select the blood cell - animation layer
- Hit Return (Mac) or Enter (Windows) to make the name editable.
Rename it cell 1 and hit Return (Mac) or Enter (Windows) to finalize.
Ctrl–click (Mac) or Right–click (Windows) on the cell 1 layer and choose Effect > Time > Echo.
-
In the Effect Controls panel (at the top left of the window):
- Echo Time (seconds): -0.273
- Number of Echoes: 5
- Echo Operator: Maximum
NOTE: Starting Intensity and Decay should already be set to 1.0 by default.
-
Use the Spacebar to preview the animation.
It may be slow to render the first time playing. Once rendered, it will play at normal speed. If you want to speed up the preview, at the bottom left of the Composition panel is a Resolution/Down Sample Factor Popup that should say (Full). Try changing that to Half or lower.
- In the Timeline, select the cell 1 layer.
Hit Cmd–D (Mac) or Ctrl–D (Windows) to duplicate the layer.
Move the playhead to 0;10
Press
[
to move the In point of the cell 2 layer to the playhead.In the Effect Controls panel, change the cell 2 layer’s Echo Time to -0.133
Wit the cell 2 layer selected, hit Cmd–D (Mac) or Ctrl–D (Windows) to duplicate it.
In the Effect Controls panel, change the cell 3 layer’s Echo Time to -0.243
Ctrl–click (Mac) or Right–click (Windows) on any of the column labels and choose Columns > In.
-
Click on the In point value for the cell 3 layer and:
- Change it to -100
- Click OK.
Ctrl–click (Mac) or Right–click (Windows) on the In column header and choose Hide This.
-
Use the Spacebar to preview the animation.
Pretty good, but some size variation on the cells would make it better.
Choose File > Save or hit Cmd–S (Mac) or Ctrl–S (Windows).
Adding Motion Blur to a Nested Comp
Motion blur is an effect built into every layer. Normally all you have to do is turn on a layer’s Motion Blur switch and you are good to go. However, when working with nested comps there are a few more steps involved.
In the Timeline, double–click on the any of the cell (cell 1, cell 2, or cell 3) nested comp layers.
-
If you don’t see the switches to the right of the blood cell 1 layer:
- Click the Toggle Switches / Modes button at the bottom of the Timeline.
Click on the layer’s Motion Blur switch.
-
Choose Composition > Composition Settings or hit Cmd–K (Mac) or Ctrl–K (Windows) and:
Click on the Advanced tab.
Change Shutter Angle to 90 (This controls the strength of the motion blur effect.)
Click OK.
In the Timeline, click on the Circulation tab to return to the parent comp.
-
Near the top of the Timeline, click the Motion Blur button to enable motion blur for the composition.
-
Use the Spacebar to preview the animation.
Motion blur is a RAM intensive effect, so your preview may take noticeably longer than before.
When you don’t need to see the motion blur, you can speed up previews by turning it off with the Motion Blur button at the top of the timeline.
Choose File > Save or hit Cmd–S (Mac) or Ctrl–S (Windows).
You’re done, so choose File > Close Project.
Optional Bonus: Working with Essential Properties
Essential properties allow you to vary the properties of layers inside of nested compositions. We’ll use this feature to vary the size of the blood cells.
-
In the Timeline, double–click on the cell 1 comp layer to open it.
NOTE: You could double–click any cell layer (they’re instances of the same comp).
In the blood cell - animation timeline, select the blood cell 1 layer.
Press S to reveal Scale.
Choose Window > Essential Graphics.
In the Essential Graphics panel, change the Primary menu to blood cell - animated
-
Drag the Scale property from the Timeline into the Essential Graphics panel.
NOTE: Adding any property in a comp to the Essential Graphics panel makes it an essential property, which can be controlled layer-by-layer when this comp is nested.
-
In the Timeline, click on the Circulation tab to return to the parent comp.
The 3 cell comp layers should now have a new Essential Properties category.
-
Choose Window > Workspace > Reset “Standard” to Saved Layout
NOTE: You can also double click the workspace name at the top of the application and then approve the reset.
In the Timeline, click the arrow for next to Essential Properties for cell 1.
Change the Essential Property Scale to 10
Click on the arrow for next to Essential Properties for cell 3.
Change the Essential Property Scale to 18
-
Ctrl–click (Mac) or Right–click (Windows) on the cell 3 layer and choose Time > Time Stretch.
- Change the Stretch Factor to 150
- Click OK.
-
Repeat this operation for the other two cell layers using the values here:
- cell 2: 200
- cell 1: 250
- Select the cell 3 layer.
Hold Shift and click on cell 1 to select all 3 cell layers.
Cmd ~ (Mac) or Ctrl ~ (Windows) to hide their visible properties.
-
Use the Spacebar to preview the animation.
The moving cells would look better with a little motion blur applied to them. We will do this in the next section.