Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression bounce help

  • Expression bounce help

    Posted by Barry Evans on July 7, 2006 at 12:57 am

    I’m quite new to expressions and need a little help.

    I’m using the following to add a little bounce to an animation:

    t=time-key(2).time;
    if (t<0){
    value;
    }else{
    veloc = 18;
    amplitude = 60;
    decay = 6;
    y = amplitude*Math.cos(veloc*t)/Math.exp(decay*t);
    value+[0,0,y];
    }

    Which starts the bounce on the second keyframe, does anyone know how i can modify it so the object bounces on every keyframe I add?

    Jack Hilkewich replied 19 years, 10 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    July 7, 2006 at 1:38 am

    Try this:

    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n–;
    }
    }
    if (n == 0){
    value
    }else{
    t = time – key(n).time;
    veloc = 18;
    amplitude = 60;
    decay = 6;
    y = amplitude*Math.cos(veloc*t)/Math.exp(decay*t);
    value+[0,0,y];
    }

    Dan

  • Jack Hilkewich

    July 7, 2006 at 2:43 pm

    Plese forgive my intrusion but what attribute does one enter this into, position? I know very little about expressions but I try to use them when I can. I just can’t figure out where to put this.

  • Dan Ebberts

    July 7, 2006 at 3:03 pm

    Yes, this would be for position property of a 3D layer. The bounce will be in the z direction. If you wanted it to bounce a 2D layer in the y direction, you would just change this:

    value+[0,0,y];

    to thie:

    value+[0,y];

    Hope that helps.

    Dan

  • Jack Hilkewich

    July 7, 2006 at 3:22 pm

    Thanks a lot!

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