In this lesson we are going to answer the most frequently asked questions: How to loop animation? How to make it have a look like it has no joins and keep the motion happen in the most natural way?



We will consider how to make each animation loop type on the example of this tree animation
Loop of path property
This
expression allows you to loop even path property that standart
loopOut() expression not able to do. It can work as simple
loopOut(“cycle”) expression, or even like “pingpong”. To make it play
animation back and forth just correct one word in the 4th line: pingPong
=false true;
try{
timeStart = thisProperty.key(1).time;
duration = thisProperty.key(thisProperty.numKeys).time-timeStart;
pingPong = false; //change to true value if you want to loop animationn back & forth
quant=Math.floor((time-timeStart)/duration);
if(quant<0) quant = 0
if(quant%2 == 1 && pingPong == true){ t = 2*timeStart+ (quant+1)*duration - time;
}
else{
t = time-quant*duration;
}
}
catch(err){
t = time;
}
thisProperty.valueAtTime(t)
loopOut() is short but really useful and versatile expression. You can create different type of loops by changing parameter in parenthesis. How each of them works is shown on the gif below.
Recreate the following animations. The first one is the simple camera movement loop, and the second is more complicated recursion loop in which you have to play around with speed graph to achieve smooth infinite movement.
If you did previous tasks without any difficulties try these. That would be nice shots to your portfolio! Sources are attached below.