Previous Lecture Complete and continue  

  7. Loops

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?

Video Thumbnail

Practice

We will consider how to make each animation loop type on the example of this tree animation

Download
Practice  1.gif
Practice  2.gif

Expressions

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

javascript
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.

LoopOut.gif

Homework

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.

Task 1.gif
Task 2.gif

Portfolio shot

If you did previous tasks without any difficulties try these. That would be nice shots to your portfolio! Sources are attached below.

Download
7_Recursion-Moustacheman_Over_Speed.gif
7_Recursion-Moustacheman-.gif
Linear_cycle.gif
7_Recursion_Tree.gif