Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Delaying a loop at its extremes.

  • Delaying a loop at its extremes.

    Posted by Edward Foster on September 29, 2014 at 5:30 pm

    Apologies in advance, but I’m terrible at expressions and this is all cobbled together from reading these and other forums.

    I have a line of text which periodically swaps its Source Text randomly with a word from a list. (Taken from here: https://provideocoalition.com/pvcexclusive/story/expression_shorts_-_random_words_cycle)

    This swap is hidden behind an animated Character Offset. The property itself has a wiggle applied to it (in order to constantly cycle characters) then the Offset property of the Range Selector that governs the Character Offset is animated by the following expression:

    //(6.2 is just a trial and error value that seems to align the loop cycle with the swapping text.)

    period = thisComp.layer(“EXP CONTROL”).effect(“Slider Control”)(“Slider”)/6.2;
    t = time;
    50*(1 – Math.cos(t / period ))

    (This is taken from a reply Dan gave on making a linear loop: https://forums.creativecow.net/thread/227/13047#13054)

    The only issue is that the loop only ping-pong’s between 0 and 100 and only fully reveals the correct text for one frame. What I need is for once 100 is reached there be a delay before beginning to animate back to 0. Unfortunately I have no idea how to do this.

    Edward Foster replied 11 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    September 29, 2014 at 6:44 pm

    Something like this should give you the waveform you’re looking for:

    period = 2;
    hold = 1;
    t = time%(period + hold);
    if (t < period/2)
    50*(1 – Math.cos(t*Math.PI*2 / period ))
    else if (t < period/2+hold)
    100
    else
    50*(1 – Math.cos((t-hold)*Math.PI*2 / period ))

    I think your 6.2 comes from needing 2*pi in there.

    Dan

  • Edward Foster

    September 29, 2014 at 6:58 pm

    Thanks so much Dan! I suspected it might need an if-else component, but I can barely memorize basic expressions. That worked great.

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