Adobe After Effects Loop Expression AKA The After Effects Repeat Expression
What is the Loop Expression?
The loop expression, as the name suggests, allows you to loop a series of keyframes. But it's not just about cycling between the first and last keyframes. It offers a lot more versatility, making it invaluable for tasks like walk cycles, logo reveals, and background designs. This is particularly helpful for time-saving and ensuring seamless loops in your animation.
How to Use the Loop Expression:
- Loop Properties: The main properties you'll encounter are loopOut and loopIn.
- loopOut(): This loops beyond the last keyframe.
- loopIn(): This loops before the first keyframe.For most projects, you'll find yourself using the loopOut property.
- Loop Types: There are different types of loops that can modify how your loop functions.
- Cycle: This simply repeats your keyframes indefinitely. When it reaches the last keyframe, it jumps back to the first. By default, a loop property without a type defined will be a cycle.
- Pingpong: As the name suggests, this type goes back and forth between your first and last keyframe.
- Offset: This type builds on itself by adding or subtracting the ending value from the starting value and applying the difference to your final or opening keyframes.
- Continue: This type continues the speed/value of the final keyframe. So, if your loop ended with a certain speed, that speed would continue beyond the final keyframe.
- Argument Modifier: This is an additional component you can add to your loop expressions. It tells After Effects which keyframes you want to loop. For instance, if you had a sequence with 5 keyframes, you could instruct After Effects to loop only the last 2. This is achieved by adding a comma and a number.
Cycle Loop
loopOut("cycle");
Pingpong Loop
loopOut("pingpong");
Offset Loop
loopOut("offset");
Continue Loop
loopOut("continue");
How to Implement the Loop Expression:
- Create your keyframes as you would for any standard animation project.
- Select the value you want to add an expression to in the Timeline.
- Navigate to Animation > Add Expression. Alternatively, hold Alt and click the Stopwatch icon next to the Value.
- In the box on the Timeline, type or paste in your desired expression. After Effects will predictively suggest elements for you.
- Check your animation and add a modifier if necessary.
Examples of Loop Expressions
- Cycle Loop (Default Behavior)
Repeats the animation from start to end in a continuous loop: - Ping-Pong Loop
Plays the animation forward, then backward, repeatedly: - Offset Loop
Each loop iteration adds to the previous cycle, creating a cumulative effect: - Continue Loop
Extends the animation naturally based on the trajectory of the last keyframe: