Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Help with note on motionscript.com

  • Help with note on motionscript.com

    Posted by Anthony Thomas on January 4, 2009 at 2:50 pm

    motionscript.com has a great expression for bouncing a ball that uses the cosine wave and the exponential curve.

    freq = 1.0; //oscillations per second
    amplitude = 90;
    decay = .5;

    posCos = Math.abs(Math.cos(freq*time*2*Math.PI));
    y = amplitude*posCos/Math.exp(decay*time);
    position – [0,y]

    However there is a note about the frequency.

    Note that you need to choose your frequency carefully to sell this effect. For example, at 30 frames per second, a frequency of 2.0 will cause the first bounce to occur half way between frames 3 and 4. So it will look like the ball never quite hits the “floor”. To have it occur exactly at frame 3, you would need to change your frequency to 2.5, and to make it occur at frame 4, you’d change the frequency to 1.875.

    How are these new frequencies calculated using the composition framerate?

    TONY T

    Dan Ebberts replied 17 years, 7 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    January 4, 2009 at 7:37 pm

    Well, you could take the frame where you want the first bounce to occur, multiply by four, and divide that result into the comp’s frame rate. That will give the necessary frequency.

    So, at 30fps, if you want the first bounce to land on frame 3, the frequency would be:

    f = 30/(3*4) = 2.5

    Dan

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