Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions loopOut pingpong doesn’t work on a mask shape?

  • loopOut pingpong doesn’t work on a mask shape?

  • Naveen Mallikarjuna

    April 11, 2012 at 12:45 pm

    Hi 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

  • Dan Ebberts

    April 11, 2012 at 3:28 pm

    I’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 pm

    Yeah, 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 pm

    How would do you a normal (non ping-pong) loop for masks?

  • Dan Ebberts

    December 31, 2012 at 10:07 pm

    This 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 am

    Thanks Dan! Works like a charm!

    (And Happy New Years Eve!)

  • Ed Stables

    April 9, 2016 at 2:37 pm

    Thank you so much for coming up with this expression. Much appreciated

  • Luis Merino

    July 13, 2018 at 4:41 pm

    Hello,
    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 pm

    Try 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 am

    This 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

Viewing 1 - 10 of 10 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy