Loop Expression – After Effects Expression

After Effects comes with many easy ways to simplify your animation. You probably have encountered in the situation of copy pasting keyframes to create repetitive animation or loop animation. Well, it sometimes works but often can become a painful task. Imagine, you want to loop “10” frames of animation over 1 min of time. Your timeline may look beautiful with those hundreds of beautiful, cute keyframes, but equally, its time taking and hard to make any changes. Here the “loop” expression comes handy. There are mainly two types of loop expression, “loopIn” and  “loopOut”. And both expressions take few parameters to customize your animation. That makes this small expression, a very useful tool to play with. With proper use of these expressions, you can create a very complex animation. As the name suggest “loopOut” and “loopOut” works mostly in opposite direction. Here we will talk about “loopOut” as it is the most used and useful expression though you can apply the same logic to the “loopIn” expression. There are also few modifiers or types can be used with loopOut expressions. Cycle, Continue, Offset and Ping Pong.  Now let’s see how we use them.

How we write this expression?

To use this expression, we can simply write “loopOut(“type”);” Note, the “o” of loopOut must be in the capital letter, and you need to change the “type” to your preferred loop type.

1. Loop Out Cycle

The most common and standard loop modifier is “cycle”. This modifier will just loop your animation to infinite time. You may write this express as “loopOut(“cycle”);” or just “loopOut();”.

 

2. Loop Out Continue

The “continue” modifier is little uncommon and does not repeat animation as other modifiers do. Instead, it continues to animate based on the velocity of the last or first keyframe. But see how impressive animation can be created using this type. I have animated the rotation of blades “0” to “90” degree and applied “loopOut(“continue”);” And it continues to rotate and keep increasing the speed of rotation.

3. Loop Out Offset

“Offset” modifier repeats the animation and offsets each cycle by the difference in the value of the property. For example, if you animate position 0 to 100 then, in next cycle the layer moves to 100 to 200, then 200 to 300 and so on.

4. Loop Out Ping Pong

The “pingpong” modifier is just as the name suggest. It repeats the animation between forward and backward. For example, if you animate the rotation of the layer from 0 to 90 degree, then in next cycle it will animate from 90 to 0 degree and in next again from 0 to 90 degree, and it continues.

5. Loop Out Duration/ Keyframe

Loop expression can also take other parameters like duration and keyframe. In that case the expression looks like loopOutDuration(type=”cycle”, duration=0) or loopOut(type=”cycle”, numKeyframes=0). It simply means it repeat the animation only at the specified time (sec) or on keyframes. For example, if you use loopOutDuration(type=”cycle”, duration=2), then each cycle will occur on 2sec, 4sec, 6 sec and so on.

Creating complex motion using loop animation – Loop Out Offset – Ping Pong

You can also combine few loop type and create complex animation. For the below example, first I have animated position, rotation, and scale of the layer and used loopOut(“offset”); to create jumping motion. Then on pre-composition, I have used time-remap and applied loopOut(“pingpong”); to create ping pong animation.

Now go ahead and create some awesome animations. Hope this was helpful. Share if you like it.

Download the project file

4 Comments

Join the discussion and tell us your opinion.

Pierre-Michelreply
September 11, 2017 at 8:52 pm

Hello, This is exactly what I would have dreamed, but the download link does not work ;(

Mographfactoryreply
September 12, 2017 at 5:10 pm
– In reply to: Pierre-Michel

Hey Pierre, I have updated the link.

Qiaoreply
April 27, 2020 at 3:26 am

Thanks

Xalanderreply
July 19, 2022 at 6:48 pm

Merci beacoup

Leave a reply