I'm new to After Effects. I'm Just wondering if anyone has any recommendations for the best way to loop animation in After Effects. I have brought over a layered vector file from Illustrator and I'm trying to loop animations I have created on individual layers. Do the layers have to be pre-composed for looping to work?
[Moved from generic Start/Help forum to the specific Program forum... Mod]
[To find a forum for your program please start at https://community.adobe.com/]
Mostly you need to use a loop expression to creat a loop between 2 keyframes in a single layer, check this link to learn more about loop expression
loopOut() will work for any animated property that has at least 2 keyframes except properties that use time (time remapping for example). For example, if you animate the position of a layer from 200, 940 to 1000, 940 in 40 frames it will move 800 pixels from left to right in 40 frames and then stop. Add loopOut() to the position property and the layer will move from 200 in x to 1000 in x every 40 frames forever. Change the expression to loopOut("pingpong') and it will go back and forth forever.
There is one other option for the loop method and that is loopOut("offset"). The offset method will continue the animation in the same direction increasing the value for each frame. Let's say you wanted to animate the hands of a clock. You could set a rotation keyframe at frame 0 for 0º, then move forward 10 frames and change the value to 10º and add loopOut("offset") and the layer would start rotating at 1º per frame and continue forever.
Now let's talk about seamless loops. If the animation you want to loop has the same value for the first and last keyframe so the values are identical you have to do a little fiddling to make a seamless loop. Take the rotation example in the previous paragraph but make the layer rotate 360º in 10 frames. Add loopOut() and you almost get a perfect loop, but frame 10 will be repeated after the second loop. To get a perfect seamless loop you have to move the CTI to frame 9, set a new keyframe. The value for frame 9, the value is 360 - 36 or 324º. When you have 3 keyframes and the value for the first is the same as the last, and the third keyframe is one frame before the last keyframe you always get a perfect seamless loop.
If you have a bunch of animation going on in a layer and you want to loop the whole thing the easiest solution is to set the out point of the layer at the last keyframe in the animation, pre-compose the layer moving all attributes to the new layer and trimming the comp to the layer length, then adding time remapping and adding the loopOut() method to time remapping. The last keyframe that is applied to the layer is actually at the end of the last frame instead of the beginning so you will end up with an empty frame in the animation unless you go to the last keyframe, back up one frame (Ctrl/Cmnd + left arrow), set a new keyframe by clicking the center diamond in the keyframe icon, then delete the last keyframe.
There's a bunch more info in the User Guide. Those few steps should get you started.
I know this was a 2019 post, but I tend to search for info and run into your nuggets of well thought out explanations. Just want to say you've taught me so much over the years, Rick! Your generosity sharing your knowledge creates a ripple effect for all those who've improved based on your posts. Many thanks!
You can loop the time of the pre-comp via time-remap and loop expression. That's the fastest but requieres that the animation is loopable.
Time remap is a bit nasty if you don't know it. It creates two keyframes, one at the start, one at the end. If you pre-comp is 4:23f long, the last visible frame is at 4:22f. But time-remap creates the end-keyframe at 4:23f, therefore you have to add a new keyframe at 4:22f and delete the last keyframe, otherwise there is a black frame on every loop.
Alternatively you can add the loop expression to every layer you want to loop. But be aware that all keyframes of all properties have to start and end on the same timecode, otherwise the inidividual animations offset to each other and after serveral loops, you got a nice chaos. You can add keyframes with same values is you don't what to change the animation and its timing. Adding keyframes with same values is the way to "hold" a loop or add a pause into the loop sequence.
For a seamless loop you only have to make sure that the first keyframe is identical to the last keyframe. The loop is not repeating the keyframe values AFTER the last keyframe, but ON the last keyframe.
For adding loop expression (and others) I recommand using this little script. If you are doing this 10 times a day each day, you get tired of typing in the expressions code everytime. It also lets you batch add loop and wiggles.