Looping animations in Adobe After Effects can save time and make your animations smooth and professional. This tutorial will guide you through how to use expressions to create infinite loop animations using the
loopOut()
and loopIn()
expressions.
🔁 What is a Loop Expression?
Loop expressions allow your animations to repeat without manually copying keyframes. They’re especially useful for animations like bouncing balls, rotating wheels, blinking lights, or UI motion.
🧩 Types of Loop Expressions
Type | Function |
---|---|
loopOut() |
Loops the animation after the last keyframe |
loopIn() |
Loops the animation before the first keyframe |
loopOut(type, numKeyframes) |
Defines type and how many keyframes to include in loop |
loopIn(type, numKeyframes) |
Same as above but works from the beginning of animation |
🔧 Basic Syntax
loopOut()
You can also specify the loop type:
loopOut("cycle") // Default: Repeats the animation cycle
loopOut("pingpong") // Reverses animation after every loop
loopOut("offset") // Offsets each loop based on previous
loopOut("continue") // Continues based on speed of last keyframe
🔄 Example 1: Looping Position Animation
🎯 Goal: Make an object bounce up and down endlessly
✅ Steps:
-
Create a solid or shape layer.
-
Add two keyframes to the Position property (e.g., move it up and then down).
-
Alt + Click on the stopwatch 🕒 to open the expression editor.
-
Add this code:
loopOut("pingpong")
🎉 Now your animation will bounce up and down forever!
🔄 Example 2: Rotating Object Infinitely
🎯 Goal: Keep rotating a shape continuously
✅ Steps:
-
Create a shape (like a wheel or gear).
-
Set two keyframes on Rotation (0° to 360°).
-
Add this expression:
loopOut("cycle")
This will loop the rotation animation continuously.
🔄 Example 3: Using numKeyframes
to Loop Partial Animation
loopOut("cycle", 2)
This loops the last 2 keyframes repeatedly, which is helpful when working with complex keyframe sequences.
🧠 Pro Tips
-
Use
continue
when you want the motion to go beyond the last keyframe smoothly. -
Combine with null objects or parenting for complex rigs.
-
Use loopIn() if you want looping before the first keyframe (e.g., entrance animations).
🧪 Custom Loop Example
Loop position only in X direction with a pingpong style:
temp = loopOut("pingpong");
[temp[0], value[1]]
This keeps X-axis motion looping, while Y stays fixed.
📦 Final Thoughts
Loop expressions are powerful and essential for every motion designer. Whether you're animating characters, UI elements, or backgrounds, mastering these expressions saves time and unlocks creative possibilities.
🔚 Stay creative with After Effects! Need more expression tutorials? Let me know.