Activity › Forums › Adobe After Effects Expressions › loopOut expression question
-
loopOut expression question
Posted by Patrick Birks on September 4, 2012 at 6:10 pmI’m trying to use a loopOut expression on a mask but I keep getting an error when doing it. Is this expression not usable on a mask?
Dan Ebberts replied 13 years, 7 months ago 2 Members · 3 Replies -
3 Replies
-
Dan Ebberts
September 4, 2012 at 7:15 pmNo, you can’t use loopOut() on paths. You can create your own though. Here are “roll your own” ping pong and cycle variations:
// ping pong loopOut()if (numKeys > 1 && time > key(numKeys).time){
t1 = key(1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
seg = Math.floor(delta/span);
t = delta%span;
valueAtTime((seg%2) ? (t1 + t) : (t2 - t));
}else
value// cycle loopOut()
if (numKeys > 1 && time > key(numKeys).time){
t1 = key(1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
seg = Math.floor(delta/span);
t = delta%span;
valueAtTime(t1 + t);
}else
valueDan
-
Patrick Birks
October 16, 2012 at 11:21 pmThanks Dan! I guess i’ve got a few questions now. Where can I go to figure out what that means because I have no idea what that is. Two how can that be changed so the loops happens later in the time line. For example I have a pulse of light that goes down a track it starts at 4 sec in last for 20 frames, how can i get it to not loop till another 4 seconds later. Hopefully that makes sense.
-
Dan Ebberts
October 17, 2012 at 7:18 pmI’m not sure if this will do what you want, but this modification will loop the number of keyframes specified by variable n:
n = 2;
if (numKeys >= n && time > key(numKeys).time){
t1 = key(numKeys-n+1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
seg = Math.floor(delta/span);
t = delta%span;
valueAtTime(t1 + t);
}else
value
The way I have it set up here, it will only loop the last two keyframes. Does that help?
Dan
Reply to this Discussion! Login or Sign Up