Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Trampoline style motion via expression?

  • Trampoline style motion via expression?

    Posted by Mike Mackenzie on July 10, 2014 at 3:28 pm

    Hey all…
    Animating a simple figure, side view, landing on a trampoline. Not jumping up and down repeatedly, but landing with some bounces as if caught by firemen. I’m not great with expressions and am having trouble with the character’s residual bounce motion. What I did was set position keyframe for the jumping point, then the landing point, then select those and option-click the stopwatch to which I pasted in a bounce expression I found online. This was nowhere near what I want…obviously I have no idea what I am doing with expressions, so any help is really appreciated. I’m on a tight deadline (aren’t we all?)…thanks!

    PS I originally posted this in the expressions forum, but this forum seems to be the most helpful.

    Jp Pelc replied 11 years, 10 months ago 3 Members · 4 Replies
  • 4 Replies
  • John Cuevas

    July 10, 2014 at 4:59 pm

    What was the initial expression you tried to modify?

    I have this overshoot expression I modified from the expressions forum, might be of some use to you, did a quick test and it sort of looks like falling into a fireman trapoline.

    7726_overshootexpression.aep.zip

    Johnny Cuevas, Editor
    Thinkck.com

    “I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work.”
    —THOMAS EDISON on inventing the light bulb.

  • Mike Mackenzie

    July 10, 2014 at 5:31 pm

    Wow, thanks for this, it’s exactly what I needed, I owe you one my friend!
    As I said, I know jack about working with all but the simplest expressions, this is the one I found online and used. It basically made my character bounce all the way down, instead of plummet then bounce:

    // Ease and Wizz 2.0.1 : inOutBounce : All keyframes
    // Ian Haigh (https://ianhaigh.com/easeandwizz/)
    // Last built: 2010-10-09T13:35:40+11:00
    // some defaults
    var p = 0.8; // period for elastic
    var a = 50; // amplitude for elastic
    var s = 1.70158; // overshoot amount for “back”
    function inOutBounce(t, b, c, d, a, p) {
    function easeOut (t, b, c, d) {
    if ((t/=d) < (1/2.75)) {
    return c*(7.5625*t*t) + b;
    } else if (t < (2/2.75)) {
    return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
    } else if (t < (2.5/2.75)) {
    return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
    } else {
    return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
    }
    }
    function easeIn(t, b, c, d) {
    return c – easeOut (d-t, 0, c, d) + b;
    }
    if (t < d/2) return easeIn (t*2, 0, c, d) * .5 + b;
    else return easeOut (t*2-d, 0, c, d) * .5 + c*.5 + b;
    }
    function easeAndWizz() {

    var n = 0;
    if (numKeys > 0) {
    n = nearestKey(time).index;
    if (key(n).time > time) { n– }
    }
    try {
    var key1 = key(n);
    var key2 = key(n+1);
    } catch(e) {
    return null;
    }

    // determine how many dimensions the keyframes need
    var dim = 1; // It’s gotta have at least ONE dimension
    try {
    key(1)[1];
    dim = 2;
    key(1)[2];
    dim = 3;
    } catch(e) {}
    t = time – key1.time;
    d = key2.time – key1.time;
    sX = key1[0];
    eX = key2[0] – key1[0];
    if (dim >= 2) {
    sY = key1[1];
    eY = key2[1] – key1[1];
    if (dim >= 3) {
    sZ = key1[2];
    eZ = key2[2] – key1[2];
    }
    }
    if ((time < key1.time) || (time > key2.time)) {
    return value;
    } else {
    val1 = inOutBounce(t, sX, eX, d, a, p, s);
    switch (dim) {
    case 1:
    return val1;
    break;
    case 2:
    val2 = inOutBounce(t, sY, eY, d, a, p, s);
    return [val1, val2];
    break;
    case 3:
    val2 = inOutBounce(t, sY, eY, d, a, p, s);
    val3 = inOutBounce(t, sZ, eZ, d, a, p, s);
    return [val1, val2, val3];
    break;
    default:
    return null;
    }
    }
    }
    (easeAndWizz() || value);

  • John Cuevas

    July 10, 2014 at 6:11 pm

    Glad you found it useful. One more thing about that script, it works on measuring a layers velocity, so you can copy the expression from position, and apply it to rotation & scale to create overshoot in those properties also.

    It doesn’t need the control layer either, you can manually enter values into freq and decay(helpful if you are working with more than one parameter at once). I only created the control layer, cause I was working with multiple layers and I was getting annoyed by having to change every value for all the layers every time I wanted to make a change.

    Johnny Cuevas, Editor
    Thinkck.com

    “I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work.”
    —THOMAS EDISON on inventing the light bulb.

  • Jp Pelc

    July 11, 2014 at 2:24 pm

    John, I’m going to be using this expression as well! Thanks for posting!!

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