Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Dan’s Expression for Time Stretch

  • Dan’s Expression for Time Stretch

    Posted by John Madison on June 14, 2012 at 1:38 pm

    Hi Dan,

    I got the following expression for a stretch effect from your site:

    freq =3;
    amplitude = 35;
    decay = 1.0;

    s = amplitude*Math.sin(freq*time*2*Math.PI)/Math.exp(decay*time);
    scale + [s,s]

    Is there a way to change this expression so that the animation starts from 0 scale value. In others words, I want the layer to ‘appear’ like a pop-up.

    John Madison replied 13 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 14, 2012 at 2:51 pm

    Try this, it may be close to what you’re looking for:


    t = time - inPoint;
    startVal = 0;
    endVal = 100;
    dur = 0.1;
    if (t < dur){
    s = linear(t,0,dur,startVal,endVal);
    }else{
    amp = (endVal - startVal)/dur;
    freq = 3;
    decay = 5;
    w = freq*Math.PI*2;
    s = endVal + amp*Math.sin((t-dur)*w)/Math.exp(decay*(t-dur))/w;
    }
    [s,s]

    Adjust the amplitude of the overshoot by changing the dur variable (smaller value = more overshoot).

    Dan

  • John Madison

    June 22, 2012 at 3:08 pm

    It works like a treat!

    If it is not too much to ask Dan, can you also help with the following:

    I am looking to move a layer so it appears to drop from the middle of the screen to the bottom. However, I want to be able to control the start of the drop and the speed with controllers. The start is to be designated by a marker preferably.
    So lets says a text layer is on the middle of the screen. At about 4 secs it drops by moving up a few pixels first and then all the way down to the bottom of the screen (or completely off screen)

    This is related to the above time stretch and hence why I am asking here.

    Thanks 🙂

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