Skip to main content
caroline_edits
Community Manager
Community Manager
June 24, 2020
Question

Tips & Tricks for looping keyframes with expressions in After Effects

  • June 24, 2020
  • 9 replies
  • 65826 views

Instead of copy-pasting your keyframes through the whole composition, use expressions to loop your animations!

 

 

Here's the walkthrough. After you've keyframed one loop of your animation...

  • Alt + click (PC) or Option + click (MAC) the stopwatch next to the parameter you want to loop – scale, position, rotation, etc.
  • Delete the code that displays in the expressions editor
  • Replace it with one of the following expressions
    • loopIn("cycle") will repeat your animation before the keyframes in your timeline. The animation will end at the last keyframe.
    • loopOut("cycle") will repeat your animation after the keyframes in your timeline. The animation will end with your composition.
    • loopOut("continue") will take the last two keyframes of your animation, and continue that stroke indefinitely.
    • loopOut("pingpong") will carry your animation forwards and backward through the keyframed positions.
    • loopOut("offset") will bring the entire animation along. The animation will repeat itself starting from the last keyframed point.

 

Note: the default loop effect is set to "cycle" and can be left out of the expression for convenience. 

  • loopIn() and loopOut() will produce the same animation as loopIn("cycle") or loopOut("cycle")

 

Hope this helps!

This topic has been closed for replies.

9 replies

New Participant
November 30, 2022

Much thanks to you for the data! My inquiry could be, imagine a scenario where you transformed the liveliness into a mogrt to use in debut. Assuming you added safeguarded locales to the Ae comp and expand the layer on the Debut timetable, could the boundless circle movement keep on playing or simply end at the first Ae comp timecode?

Inspiring
November 7, 2022

Basically the same information but with helpful animations!

 

https://www.schoolofmotion.com/blog/loop-expression-after-effects

frankmansfield
New Participant
June 21, 2022

I've actually made a really simple panel you can use to automatically add loop expressions (including to shape layers).  I do a lot of looping and I've found it a real time-saver!
You can download it (free) from:

https://frankmansfield.co.uk/stuff/loop.php

Give me a shout with any questions  🙂

Cheers
-f

Joost van der Hoeven
Community Expert
August 28, 2022

Amazing! Thanks.

frankmansfield
New Participant
October 12, 2022

My absolute pleasure - hope it helps my fellow loopers!  🙂

New Participant
April 4, 2022

Thank you for the info! My question would be, what if you turned the animation into a mogrt to use in premiere? If you added protected regions to the Ae comp and extend the layer on the Premiere timeline, would the infinite loop animation continue to play or just end at the original Ae comp timecode? 

lariri
New Participant
March 17, 2022

Thanks for sharing

New Participant
February 17, 2022

Thanks for sharing. It was quite informative.

Harold Silva
Community Expert
November 29, 2021

Excelente aporte!
saludos

Harold Silva B.
July 13, 2020

That's cool. Here is the way that i usually do, you can check on it:

You mographers probably use a simple loop expression, “loopOut()”. And I think once you’ve thought that you wanted to loop only specific keyframes like an image above. It’s easy to do with expression!

[Expression]

1
loopOut("cycle", 2);

 

[Quick Explanation]

1
loopOut(type="cycle", numKeyframes=0);

loopOut() has 2 arguments, loop type and number of keyframes. The number of keyframes is keyframe segments to loop. If you use “loopOut(“cycle”, 1)”, it loops the segment bounded by the last keyframe and second to last keyframe.

I learn this from beatgram. It's while useful.

 

Best regards,

ThaiSon

 

 

Participating Frequently
May 30, 2023

Thanks for sharing!! Reading this in 2023 and it's the clearest explanation of how "cycle" works with keyframe "segments." Extremely helpful!

Mathias Moehl
Community Expert
July 6, 2020

Little extra tip:

If you own iExpressions, you can create these loops without writing any expression code yourself.

The Loop iExpression offers all the features of the loopIn and loopOut expression plus some very handy extra features like looping both in and out simultaneously and to auto-smooth loops.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
caroline_edits
Community Manager
Community Manager
July 9, 2020

Nice addition, Mathias! Thanks for the bonus.