Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions free wiggle, rubber, bounce, throw, inertia expressions i find useful

  • free wiggle, rubber, bounce, throw, inertia expressions i find useful

    Posted by Chris Wright on October 6, 2009 at 10:32 pm

    These expressions save so much time, you might get home earlier tonight just by reading this post. If you’ve ever animated these sorts of things manually, you’ll know what I mean. Most will need to be tweaked to your specific needs, but it’s just a matter of playing with the numbers a little, and understanding how they’ll change your animation. Here’s the goods:

    Jumpy Wiggle 1 makes wiggle skip and hold rather than move fluidly.

    // Jumpy Wiggle 1 (moves at a random FPS)
    v=wiggle(5,50);
    if(v < 50)v=0; if(v > 50)v=100;
    v

    Jumpy Wiggle 2 is similar to 1, but works at a defined FPS so your “jump” will happen at a regular pace.

    // Jumpy Wiggle 2 (moves at a defined FPS)
    fps=5; //frequency
    amount=50; //amplitude
    wiggle(fps,amount,octaves = 1, amp_mult = 0.5,(Math.round(time*fps))/fps);

    Inertial Bounce is like making your moves “rubbery.” Layers will overextend, then settle into place on position and rotation keyframes.

    // Inertial Bounce (moves settle into place after bouncing around a little)
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n–;
    }
    }
    if (n == 0){
    t = 0;
    }else{
    t = time – key(n).time;
    }

    if (n > 0){
    v = velocityAtTime(key(n).time – thisComp.frameDuration/10);
    amp = .05;
    freq = 4.0;
    decay = 2.0;
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value;
    }

    Sometimes you just want something to move constantly without keyframing it. Use throw.

    // Throw (move at a constant speed without keyframes)
    veloc = -10; //horizontal velocity (pixels per second)
    x = position[0] + (time – inPoint) *veloc;
    y = position[1];
    [x,y]

    Same as throw, but for rotation.

    // Spin (rotate at a constant speed without keyframes)
    veloc = 360; //rotational velocity (degrees per second)
    r = rotation + (time – inPoint) *veloc;
    [r]

    A shoutout to the brilliant folks at aenhancers.com who provided in whole or in part the basis for all of these expressions.

    https://technicolorsoftware.hostzi.com/

    Scott Green replied 12 years, 10 months ago 11 Members · 16 Replies
  • 16 Replies
  • Andy George

    October 9, 2009 at 6:51 pm

    Thanks Chris!

    -Andy

  • Emil Woodruffe

    October 13, 2009 at 7:39 am

    very useful, thanks Chris

  • Ashwani Sharma

    November 4, 2009 at 4:40 pm

    Found very useful. Please illustrate how to use the following: –
    Inertial Bounce is like making your moves “rubbery.” Layers will overextend, then settle into place on position and rotation keyframes.

    // Inertial Bounce (moves settle into place after bouncing around a little)
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n–;
    }
    }
    if (n == 0){
    t = 0;
    }else{
    t = time – key(n).time;
    }

    if (n > 0){
    v = velocityAtTime(key(n).time – thisComp.frameDuration/10);
    amp = .05;
    freq = 4.0;
    decay = 2.0;
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value;
    }

    Inertial Bounce is like making your moves "rubbery." Layers will overextend, then settle into place on position and rotation keyframes.

    // Inertial Bounce (moves settle into place after bouncing around a little)
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    t = 0;
    }else{
    t = time - key(n).time;
    }

    if (n > 0){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    amp = .05;
    freq = 4.0;
    decay = 2.0;
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value;
    }

  • Chris Wright

    November 4, 2009 at 8:00 pm

    for Inertial Bounce, keyframe a shape layer changing direction, then alt click for expression, paste in code, the circle shape will stretch with centrifugal force to the other side back and forth. It’s useful for camera movements too if set low.

    https://technicolorsoftware.hostzi.com/

  • Ashwani Sharma

    November 5, 2009 at 11:26 am

    Thanks, Mr. Chris

  • Bruno Barwise

    December 6, 2009 at 10:45 am

    Thanks for these great time saving scripts!

    Could anyone clarify how the variables freq, amp and decay work exactly? It seems like the higher the value of decay, the shorter the decay is? Any info would take some of the guess work out for script non-experts like myself 🙂

  • Multipasser

    July 3, 2012 at 2:10 am

    It is an old but still GREAT topic!
    I really love those expressions but it seems they dont work that well in CS6?

    What needs to be changed or updated?

  • Dan Ebberts

    July 3, 2012 at 2:39 pm

    Can you be more specific? In what way are they not working?

    Dan

  • Michael Goeller

    July 26, 2012 at 10:46 am

    I have been using Jumpy Wiggle 2 without any issues in CS 6.

    // Jumpy Wiggle 2 (moves at a defined FPS)
    fps=5; //frequency
    amount=50 //amplitude
    wiggle(fps,amount,octaves = 1, amp_mult = 0.5,(Math.round(time*fps))/fps);

  • Layne Haacke

    August 20, 2012 at 9:43 pm

    In CS6 I’m having a new problem with the inertial bounce expression that I’ve used for a long time.
    it only has a problem in AE CS6.

    Here is the expression

    amp = .1;
    freq = 1.0;
    decay = 4.0;

    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n–;
    }}

    if (n == 0){ t = 0;
    }else{
    t = time – key(n).time;
    }

    if (n > 0){
    v = velocityAtTime(key(n).time – thisComp.frameDuration/10);
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{value}

    here is a screen cap of the error warning

    it works sometimes and then other times it gives an error.
    any input for a fix would be appreciated.

    amp = .1;
    freq = 1.0;
    decay = 4.0;

    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n--;
    }}

    if (n == 0){ t = 0;
    }else{
    t = time - key(n).time;
    }

    if (n > 0){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{value}

Page 1 of 2

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