Activity › Forums › Adobe After Effects Expressions › loopOut pingpong doesn’t work on a mask shape?
-
loopOut pingpong doesn’t work on a mask shape?
Posted by Naveen Mallikarjuna on April 11, 2012 at 12:45 pmHi all.
Long time AE user, new to expressions.
I’m trying to apply the loopOut(“pingpong”) expression to an animating mask. Doesn’t seem to work. Is this an expression that does not apply to mask shapes?
(To be sure I was doing it right, after it didn’t work, I used the expression on the Rotation parameter. When that worked, I copied and pasted the expression to ensure my syntax was correct.)
Thanks!
Naveen
Tim Gala replied 7 years, 10 months ago 6 Members · 9 Replies -
9 Replies
-
Dan Ebberts
April 11, 2012 at 3:28 pmI’m surprised it doesn’t work. Well, you can “roll your own” ping pong expression. This should work:
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
Dan
-
Naveen Mallikarjuna
April 11, 2012 at 6:19 pmYeah, I’m surprised too. Here’s what I get:
Bad method arguments: loop is not supported for custom properties
Expression disabled.I guess the animation of the mask shape is something loop doesn’t handle.
Naveen
-
Navarro Parker
December 31, 2012 at 9:49 pmHow would do you a normal (non ping-pong) loop for masks?
-
Dan Ebberts
December 31, 2012 at 10:07 pmThis should work:
if (numKeys >1 && time > key(numKeys).time){
t1 = key(1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
t = delta%span;
valueAtTime(t1 + t)
}else
value
Dan
-
Navarro Parker
January 1, 2013 at 12:24 amThanks Dan! Works like a charm!
(And Happy New Years Eve!)
-
Ed Stables
April 9, 2016 at 2:37 pmThank you so much for coming up with this expression. Much appreciated
-
Luis Merino
July 13, 2018 at 4:41 pmHello,
I have a big question!I’m trying to loop a path but i want the loop to be “Pingpong” after the first keyframe.
According to what I’ve read, this is the expression for looping paths but it only works for cycle loop.Is there any way to make it work as a pingpong loop?
if (numKeys >1 && time > key(numKeys).time){
t1 = key(1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
t = delta%span;
valueAtTime(t1 + t)
}else
value -
Dan Ebberts
July 13, 2018 at 5:43 pmTry it this way:
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
Dan
-
Tim Gala
September 4, 2018 at 2:26 amThis is awesome Dan.
However, in my case, it seems to result in some flashing.
I rendered to see if it was just a preview performance thing.
Take a look if you have a moment to look at a simple wavy line.
Wavy Line example
Reply to this Discussion! Login or Sign Up