Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects How to loopOut(“pingpong”) with a variable

  • How to loopOut(“pingpong”) with a variable

    Posted by Bia Lemos on July 9, 2020 at 11:52 pm

    hey guys
    i’m new to expressions in after effects. but i know how to use loopOut() by creating the keyframes i need. what i want to do now is to apply a loop in the X scale which is already changing throughout my animation.

    here is the thing: i have an object that changes its size, growing proportionally in the X and Y, but sometimes the X is a negative number (so the image flips).

    while it does that, i’d also like it to changes its X size back and forth in a loop.
    adding 3, going back to its actual size, and then subtracting 3.
    for example: (-97, 100) > (-100,100) > (-103,100) > (-100,100) > (-97,100) and so forth

    that being said, i need to the X value to be a variable. so it will loop the X scale automatically according to the X,Y scale animation i have already done manually with keyframes. (and if the value on X is negative, it has to stay negative)

    i do have experience with coding but not with javascript.
    idk what to do. any ideas?

    thanks xoxo

    Robert Müller replied 5 years, 10 months ago 2 Members · 1 Reply
  • 1 Reply
  • Robert Müller

    July 10, 2020 at 8:40 am

    You could use sine for this, like this maybe?
    spd = 5;
    fct = 3;
    s=Math.sin(time*spd)*3;
    [value[0]+s,value[1]]

    “spd” is the speed of the sine function and “fct” is by how much the value will change.

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