Using the loopOut() Expression in After Effects
Master After Effects loopOut expressions for seamless animations
What You'll Learn in This Tutorial
Expression Fundamentals
Master the basics of After Effects expressions and understand how these code snippets automate animation tasks. Learn why expressions are less intimidating than they appear.
Three Loop Types
Discover the differences between ping pong, cycle, and offset loop expressions. Each serves specific animation needs for different motion patterns.
Practical Clock Animation
Build a complete animated clock with realistic movement patterns. Apply looping expressions to pendulum, minute hand, and hour hand animations.
This tutorial uses a pre-built clock graphic created in Adobe Illustrator with separate layers for each animated element. The project file includes all necessary assets in the assets folder for immediate use.
Project Setup Process
Download and Extract
Download the project files and unzip if necessary to access all required assets and compositions.
Open Mantle Clock Precomp
Double-click on the mantle clock layer to enter the precomposition where all animation work will be performed.
Identify Animation Elements
Locate the three main elements that will be animated: hour hand, minute hand, and pendulum components.
The anchor point serves as the reference point for all transformations in After Effects. Proper placement is crucial for realistic rotation animations, especially for mechanical objects like clock parts.
Anchor Point Setup Checklist
This tool allows you to reposition anchor points without moving the layer visually
Position at the pivot point where the pendulum would naturally swing from
Place at the base where the hand connects to the clock mechanism
Ensure smooth rotation around the clock's central axis
Loop Expression Types Comparison
| Feature | Expression Type | Behavior | Best Use Case |
|---|---|---|---|
| loopOut('pingpong') | Reverses direction at each end | Pendulum swinging motion | |
| loopOut() or loopOut('cycle') | Continues in same direction | Continuous rotation like minute hand | |
| loopOut('offset') | Adds initial value each loop | Incremental movement like hour hand |
Pendulum Animation Workflow
Set Initial Keyframe
Press R for rotation, click stopwatch, and set rotation to 30 degrees at the starting position.
Create Opposite Motion
Move playhead to 1 second mark and change rotation to -30 degrees for the swing motion.
Apply Easy Ease
Select both keyframes, right-click, and choose Easy Ease for smooth, organic motion.
Add Loop Expression
Alt-click the rotation stopwatch and type loopOut('pingpong') for continuous swinging.
Animation Timeline Structure
Pendulum Setup
30 to -30 degrees over 1 second with pingpong loop
Minute Hand Animation
One full revolution with continuous cycle loop
Hour Hand Movement
30-degree increment with offset loop for cumulative rotation
Using Expressions vs Manual Animation
Loop expressions automatically adjust when you modify keyframe timing or extend composition length. This flexibility makes them invaluable for iterative design work and client revisions.
Beyond Clock Animation Applications
Vehicle Animations
Create continuously rotating wheels for cars, bicycles, or machinery. The cycle loop ensures smooth, perpetual motion without manual keyframing.
Character Animation
Animate bouncing elements, breathing effects, or repetitive character movements. Ping pong loops work perfectly for back-and-forth motions.
Complex Motion Paths
Apply offset expressions to objects following unusual paths like spirals or figure-8 patterns. The expression repeats the entire motion path seamlessly.
Key Takeaways