Animation Loops in After Effects with Expressions
Master Expression-Based Animation Looping in After Effects
Animation Efficiency
There can be no animation prior to your first keyframe on the timeline. There is no animation after your last keyframe on the timeline. That's just how the universe works.
Animation Methods Comparison
| Feature | Keyframes | Expressions |
|---|---|---|
| Complexity | Manual duplication | Single code line |
| Repetition | Copy-paste many frames | Automatic looping |
| Maintenance | High effort updates | Single point changes |
| File Size | Large with duplicates | Minimal overhead |
Essential After Effects Expressions
loop out
Repeats animation after the last keyframe. Creates seamless continuous loops from existing keyframe sequences.
wiggle
Adds random movement variations to properties. Commonly used for natural motion effects and camera shake.
random
Generates random values for properties. Provides more controlled randomization than wiggle for specific use cases.
time multiplication
Multiplies values by time for continuous increases. Essential for creating linear progressions and counters.
Expression Types
Loop out starts looping after the last keyframe. There's also loop in which works before the first keyframe, but loop out is typically what you need for continuous animations.
Loop Types Available
Cycle (Default)
Plays the animation sequence over and over again in the same direction. Most common choice for continuous motion.
Ping Pong
Plays the animation forward then backward repeatedly. Creates back-and-forth motion effects for specific use cases.
Adding Expression to Property
Locate the Stopwatch
Find the stopwatch icon next to any property. Hover to see the tooltip explaining animation toggle and expression options.
Alt-Click Stopwatch
Hold Option (Mac) or Alt (Windows) and click the stopwatch. Numbers turn red indicating expression mode is active.
Access Expression Field
The expression arrow opens showing the text field below keyframes. Delete any dummy text that appears automatically.
Writing the Loop Out Expression
Start Typing
Type 'loop' in the expression field. After Effects will display autocomplete suggestions to help avoid typos.
Select from List
Use arrow keys to navigate suggestions and press Enter or double-click 'loop out'. This prevents common spelling errors.
Optional Parameters
Add semicolon if desired (optional). Include parameters in quotes only to override default cycle behavior.
Expressions are case-sensitive and spelling-sensitive. Typos including incorrect capitalization will cause the expression to fail. Always use the autocomplete suggestions to avoid errors.
Expression Implementation Checklist
Loop out requires existing keyframes to function properly
Regular click creates keyframes, Alt-click creates expressions
Clear the expression field before typing your code
Prevents typos and ensures correct syntax
Verify the animation repeats at correct intervals
Access Help > Expression Reference for additional parameters
This lesson is a preview from our After Effects Course Online (includes software) and After Effects Certification Course Online (includes software & exam). Enroll in a course for detailed lessons, live instructor support, and project-based training.
Key Takeaways