Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to use the loopOut(cycle) expression but also increment property position per cycle?

  • How to use the loopOut(cycle) expression but also increment property position per cycle?

    Posted by Craig Ricker on August 19, 2011 at 2:14 am

    Hi there,

    Basically i’m trying to make bubbles in a glass of beer. I would like to cycle the position and opacity properties on the layer. But everytime the cycle repeats I would like the position of the bubble to move 10 units to the right.

    How woudl I go about writing this as an expression. I understand the cycle expression.

    many thanks
    Craig

    loopOut(type="cycle",numkeyframes=0)

    Todd Kopriva replied 14 years, 8 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    August 19, 2011 at 2:54 am

    You could create your own version of loopOut with an offset, like this:


    if (numKeys > 1){
    t0 = key(1).time;
    t1 = key(numKeys).time;
    delta = t1-t0;
    t = (time-inPoint)%delta;
    offset = Math.floor((time-inPoint)/delta)*[10,0];
    valueAtTime(t0+t) + offset
    }else
    value

    Dan

  • Craig Ricker

    August 19, 2011 at 5:33 am

    Thanks for the reply.

    Been trying to work out what your code is doing. I’m kinda noob to code.
    Do you think you could explain what each line is doing, just so I can learn how it works.

    What does the % sign mean?

  • Todd Kopriva

    August 19, 2011 at 6:31 am

    The % sign is the modulus operator.

    https://www.w3schools.com/js/js_operators.asp

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    Technical Support for professional video software
    After Effects Help & Support
    Premiere Pro Help & Support
    ———————————————————————————————————

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