ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Loop keyframes gains over time

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Gerald Soto
Loop keyframes gains over time
on Jul 25, 2017 at 4:16:37 pm

for example: I have a walk cycle of a character that bobs up and down between two keyframe as well as position move about 50 pixels to the left. Well I want that motion to loop again and again but at the same time move another 50 pixels every time it loops so it makes its way off screen. How would i go about creating a loop that gains over time? I have found an expression where you can choose which keyframes to loop and how many times, so i figured that would be a good start but how would i be able to have it gain every time it loops?

if (numKeys > 1){
nLoops = 5;
t1 = key(1).time;
t2 = key(2).time;

if (time &lt; t1)
value
else if (time &lt; t1 + nLoops*(t2-t1))
valueAtTime(t1 + (time - t1)%(t2-t1))
else
valueAtTime(t2 + time - (t1 + nLoops*(t2-t1)));
}else
value


Return to posts index

Dan Ebberts
Re: Loop keyframes gains over time
on Jul 25, 2017 at 6:16:56 pm

Have you tried loopOut("offset") ?

Dan



Return to posts index

Gerald Mark Soto
Re: Loop keyframes gains over time
on Jul 25, 2017 at 6:32:19 pm

Oh damn, BOOM!. Done. Perfecto. Do you think there is a way to include it into the expression in the initial post? For example: having 4 keyframes and wanting the last 2 keyframes to loopOut("offset")?


Return to posts index


Dan Ebberts
Re: Loop keyframes gains over time
on Jul 25, 2017 at 6:40:05 pm

As I recall, this should loop the last 2 keyframes:

loopOut("offset",1);

Dan



Return to posts index

Gerald Mark Soto
Re: Loop keyframes gains over time
on Jul 25, 2017 at 6:49:00 pm

Ding Ding Ding. Its like obvious-ville for you huh. Simplistic expressions sometimes just escape my grasp. Thanks Again. So to add on to this procedure how would i go about stopping the loop after 5 loops and maintain its last position of the loop?

Once again thank you for you expedience and knowledge.


Return to posts index

Dan Ebberts
Re: Loop keyframes gains over time
on Jul 25, 2017 at 7:13:23 pm

Hmm...

I think that starts to look more like your original expression:


nLoops = 5;

t1 = key(numKeys-1).time;
v1 = key(numKeys-1).value;
t2 = key(numKeys).time;
v2 = key(numKeys).value;
if (time < t2 + nLoops*(t2-t1))
loopOut("offset",1)
else
v2 + nLoops*(v2-v1)



Dan



Return to posts index


Gerald Mark Soto
Re: Loop keyframes gains over time
on Jul 25, 2017 at 7:30:00 pm

Wamo! excellent. exactly what i needed. Thanks again seƱor.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]