Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Does a simple keyframable elastic/spring solution exist?

  • Does a simple keyframable elastic/spring solution exist?

    Posted by Josh Johnson on September 13, 2007 at 4:50 pm

    Once upon a time motion math had the spring script that seemed be the awnser. Motion math went away before I was ready to start thinking about considering getting into scripting animations.

    I did a search for this before and found some really neat tricks from Dans site. The most helpful expression I found was his famous jack n the box spring expression:
    veloc=5;
    amplitude=100;
    decay=3.0;
    y=amplitude*Math.sin(veloc*time)/Math.exp(decay*time);
    scale+[y,y,y]

    Not exactally what I was after, for awhile it was enough.
    I also work with Cinema 4D and Mograph, they have a delay effector that achieves this keyframeable spring effect with the greatest of ease … I’m hungy like the wolf.

    There has to be a way to make this happen in AE. Does anyone have any clues?

    Matthew Tully replied 18 years, 6 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    September 13, 2007 at 4:58 pm

    If Motion Math would work, this expression solution might be helpful:

    https://www.motionscript.com/design-guide/elastic.html

    Dan

  • Josh Johnson

    September 13, 2007 at 5:07 pm

    WOW!

    Thats really great. I must have missed that one. Thank you Dan.

    But does something exist that you can apply to the property?
    So say it can be applied to keyframes on positon OR rotation, rather than having one layer follow another.

  • Dan Ebberts

    September 13, 2007 at 5:20 pm

    Not that I know of, but that’s a great idea. You should be able to modify the position expression to work for rotation. I’ll give it some thought.

    Dan

  • Dan Ebberts

    September 13, 2007 at 8:52 pm

    This modified version seems to work for rotation. It’s actually a little simpler than the position version because you don’t have to deal with vectors.

    restAngle = 0;
    damp = .95;
    leader = thisComp.layer(“leader”);

    fDur = thisComp.frameDuration;
    currFrame = Math.round(time / fDur);

    r2 = transform.rotation.valueAtTime(0);
    v2 = 0;
    for (f = 0; f <= currFrame; f++){ t = f*fDur; r1 = leader.transform.rotation.valueAtTime(t); delta = r2 - r1; a = 2 *(delta - restAngle) * fDur; v2 = (v2 - a) * damp; r2 += v2; } r2 Dan

  • Matthew Tully

    October 30, 2007 at 3:53 pm

    Is there a way to more precisely control the amount of decay? For instance, I want to trigger the animation and then as soon as the leader layer hits its mark the following layer stops within 30 frames.

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