Skip to main content
April 2, 2026Jerron Smith/4 min read

Animation Loops in After Effects with Expressions

Master Expression-Based Animation Looping in After Effects

Animation Efficiency

3
keyframes needed for complex loops
4
essential expressions most users know
Animation Limitation

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

FeatureKeyframesExpressions
ComplexityManual duplicationSingle code line
RepetitionCopy-paste many framesAutomatic looping
MaintenanceHigh effort updatesSingle point changes
File SizeLarge with duplicatesMinimal overhead
Recommended: Use expressions for repeating animations to maintain efficiency and editability

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

Pros
Some expressions replace keyframes entirely like random
Loop expressions work with existing keyframes
Expressions can be combined with traditional animation
JavaScript-like syntax is widely transferable
Cons
Learning curve for non-programmers
Case-sensitive and spelling-sensitive
Typos are the most common coding errors
Limited to four basic expressions for most users
Loop Direction

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

1

Locate the Stopwatch

Find the stopwatch icon next to any property. Hover to see the tooltip explaining animation toggle and expression options.

2

Alt-Click Stopwatch

Hold Option (Mac) or Alt (Windows) and click the stopwatch. Numbers turn red indicating expression mode is active.

3

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

1

Start Typing

Type 'loop' in the expression field. After Effects will display autocomplete suggestions to help avoid typos.

2

Select from List

Use arrow keys to navigate suggestions and press Enter or double-click 'loop out'. This prevents common spelling errors.

3

Optional Parameters

Add semicolon if desired (optional). Include parameters in quotes only to override default cycle behavior.

Coding Sensitivity

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

0/6

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.

Here's something remarkable: that demonstration video contains just three keyframes—the exact ones we created moments ago. The entire fluid animation emerges from these three simple points in time. To make this animation cycle continuously, we'll leverage one of After Effects' most powerful features: expression-based looping. Without this technique, the animation would execute once and stop dead in its tracks.

This brings us to a fundamental rule of timeline animation: motion exists only between keyframes. No animation occurs before your first keyframe, and none continues after your last. This isn't a software limitation—it's how temporal animation systems function across the industry. However, there's an elegant workaround that transforms this constraint into creative opportunity.

We're now entering section 5b of our workflow—page 134 in your reference materials—covering expression-driven animation loops. While you could theoretically copy and paste keyframes to extend the animation, this approach quickly becomes unwieldy and creates maintenance nightmares. Professional animators rarely take this route, and for good reason.

Instead, we'll use code-based looping—specifically, After Effects expressions. Before you recoil at the mention of "code," understand this: we're talking about a single word command, not complex programming.

Expressions represent After Effects' scripting backbone, sharing DNA with JavaScript while maintaining their own syntax and functions. While expression specialists exist—complete with dedicated books, forums, and communities—most professional users master just four essential commands: `loopOut` (for repeating animations), `wiggle` (for organic randomization), `random` (for controlled randomness), and basic mathematical operations for progressive value changes. These four tools handle 90% of real-world expression needs.

Understanding the distinction between expression types proves crucial for effective implementation. Some expressions, like `random`, replace keyframes entirely, generating motion algorithmically. Others, like `loopOut`, require existing keyframes to function—they analyze your keyframe pattern and extend it infinitely beyond the final keyframe.


The `loopOut` function operates post-timeline, meaning it kicks in after your last keyframe plays. (Its counterpart, `loopIn`, works before the first keyframe, though that's rarely needed when keyframes begin at timeline start.) With `loopOut` applied, our two-second animation becomes perpetual: play, repeat, play, repeat, indefinitely.

After Effects offers several loop types, each serving different creative purposes. The default "cycle" mode provides straightforward repetition—perfect for our current needs. Alternative modes include "ping pong" (forward-then-reverse playback) and "offset" (cumulative looping), though cycle mode handles most professional scenarios.

For deeper exploration, After Effects' built-in help system (Help > Expression Reference) contains comprehensive looping tutorials and documentation. Expression-based looping has become industry standard, particularly for motion graphics and UI animation work.

Implementation follows a straightforward process accessible through After Effects' interface design. Every property featuring a stopwatch icon supports both keyframe animation and expression control. Hovering over any stopwatch reveals the interaction model: standard click toggles keyframe animation, while Option+click (Alt+click on Windows) activates expression mode.

Let's apply this to our position property. Option+clicking the position stopwatch triggers several visual changes: the property values turn red (indicating active expression control), an expression arrow appears, and a text input field opens below the keyframes. This field initially contains placeholder text that serves no function—delete it completely before proceeding.


Now for the actual expression input. Begin typing "loop" and After Effects' intelligent autocomplete system activates, presenting a dropdown menu of available functions. This autocomplete isn't just convenience—it's error prevention. Expression syntax demands precise spelling and capitalization; even minor typos will break functionality entirely.

Navigate the autocomplete options using your arrow keys, locate "loopOut," and press Return or double-click to insert the complete function name. The system writes the proper syntax automatically, eliminating transcription errors that plague manual code entry.

Your reference materials suggest adding parameters within parentheses and ending with a semicolon. Both elements are optional for basic looping. The parentheses would contain loop type specifications (like "pingpong" for alternating playback), but omitting them defaults to cycle mode—exactly what we need. Similarly, the semicolon, while programming best practice, isn't required for single-line expressions in After Effects.

Key Takeaways

1Complex animations can be created with just three keyframes using expression-based looping instead of manual keyframe duplication
2Animation only exists between keyframes - there is no motion before the first or after the last keyframe without expressions
3Most After Effects users only need to know four essential expressions: loop out, wiggle, random, and time multiplication
4Loop out expression creates continuous animation after the last keyframe, with cycle as default behavior and ping pong as alternative
5Expressions are added by Alt-clicking (Option-click on Mac) the stopwatch icon, which turns property values red
6After Effects expressions are JavaScript-like but not exactly JavaScript, with extensive documentation available in help references
7Autocomplete suggestions prevent the most common expression errors which are typos and incorrect capitalization
8Some expressions like random replace keyframes entirely, while others like loop out work with existing keyframe data

RELATED ARTICLES