Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects basic spring expression

  • basic spring expression

    Posted by Raystar Devo on January 30, 2009 at 6:32 pm

    This maybe should be in Expressions forum, but it’s possible it’s a quite basic and simple something I’m overlooking.

    I need to have images pop up and be springy as the camera ‘flies’ over them. (maybe even retract)

    I found this one at the cow, and I placed it into the item’s anchor point. (I changed the original y value appearing in the end to z, to no avail)

    veloc = 80;
    amplitude = 80;
    decay = 1.0;
    z = amplitude*Math.cos(veloc*time)/Math.exp(decay*time);
    value + [0,z]

    A) I can’t seem to get this to control the Z-anchor point only or the items z-distance from the anchor pt.

    B) I need it to execute AFTER the image/layer pops up toward the camera

    Obviously expressions not my strong area, but this one works nicely on the y axis, (up & down)

    any help is good help

    thanx
    -r

    Tom Smith replied 17 years, 5 months ago 3 Members · 3 Replies
  • 3 Replies
  • Kevin Camp

    January 31, 2009 at 12:39 am

    to get the z axis to be effected by the expression the last line should be like this:

    value + [0,0,z]

    the coordinates within the brackets just needed to be in x,y,z.

    to get it to be triggered at the end of a move, you would just need to add an if/else statement… if your movement was created on the anchor point property then this might work:

    if (time>key(numKeys).time){
    veloc = 80;
    amplitude = 80;
    decay = 1.0;
    z = amplitude*Math.cos(veloc*time)/Math.exp(decay*time);
    value + [0,0,z];
    }else{
    value;
    }

    this will trigger the expression after the last key frame in the anchor point property.

    if the movement for the layer is in the position property the expression could be like this:

    if (time>transform.position.key(transform.position.numKeys).time){
    veloc = 80;
    amplitude = 80;
    decay = 1.0;
    z = amplitude*Math.cos(veloc*time)/Math.exp(decay*time);
    value + [0,0,z];
    }else{
    value;
    }

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Raystar Devo

    February 1, 2009 at 3:14 pm

    THAT’s IT!

    That’s exactly what I needed.

    Took me a few to figure out that the decay needs to be larger for spring to end sooner, but I’m figuring it out slowly but surely.

    Thanx so much for your help…

    -r

  • Tom Smith

    March 25, 2009 at 7:54 pm

    Kevin,

    I came across this great script searching for something else and I thought I’d give it a try. Works great with only 2 key frames but when I tried additional moves all scripts no longer worked. What can I change or add to this so my object springs any time it stops moving?

    Tom

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