Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions: bounce version of this overshoot Expression Selector code for text?

  • Expressions: bounce version of this overshoot Expression Selector code for text?

    Posted by Paul Hasas on September 29, 2019 at 6:33 pm

    Hi all. I’m taking an online AE course, and I picked up this very useful code for auto-animating overshoot, when using an Expression Selector on a text layer. There are no keyframes, and no other selectors aside from the Expression Selector. You simply choose a property to animate (e.g. Scale, set to 0%), and add this code to the selector’s Amount property. The problem is, the course doesn’t supply a “bounce” variant of this code, just the overshoot. I’ve tried adapting this code myself, using some of the standard auto-bounce expressions snippets floating around online as reference, but my results are buggy and unpredictable, and I don’t know enough Expressions / math to fix. Can anyone help? Here’s the original overshoot code:

    freq = 2;
    decay = 4;
    delay = .05; // delay between animation of nearest units
    dur = .12; // unit animation duration

    myDelay = (textIndex - 1) * delay;
    t = time - (inPoint + myDelay);
    startVal = 100;
    endVal = 0;

    if (t < dur) {
    linear(t, 0, dur, startVal, endVal);
    } else {
    amp = (endVal - startVal) / dur;
    w = freq * Math.PI * 2;
    endVal + amp * (Math.sin(t * w) / Math.exp(decay * t) / w);
    }

    Perry Sheppard replied 5 years, 11 months ago 2 Members · 4 Replies
  • 4 Replies
  • Paul Hasas

    September 29, 2019 at 6:57 pm

    Wasn’t gonna bother posting my duct-taped bounce variant, but here it is. This is the one that gets me closest to a working result. The problem is, after the initial bounces stop, they start up again and keep jumping higher and higher.

    bounces = 5;
    decay = 2;
    delay = .2; // delay between animation of nearest units
    dur = .3; // unit animation duration

    myDelay = (textIndex - 1) * delay;
    t = time - (inPoint + myDelay);
    startVal = 200;
    endVal = 0;

    freq = 1 / dur;
    mult = (bounces - Math.floor(t * freq)) / bounces;

    if (t < dur) {
    linear(t, 0, dur, startVal, endVal);
    } else {
    amp = (endVal - startVal) / dur;
    endVal - (amp / 10) * (Math.abs(Math.sin(freq * t * Math.PI)) * Math.pow(mult, decay));
    }

  • Paul Hasas

    October 17, 2019 at 5:24 am

    bumpage. Anyone know? Paging Dan Ebberts.

  • Paul Hasas

    May 19, 2020 at 10:15 pm

    epic final bump. Nobody?

  • Perry Sheppard

    July 14, 2020 at 4:26 pm

    I’m new to coding, but have been working on something similar. Without really getting into your code specifically, I think you need to have at least three, or possibly four time references. The third would indicate when the bouncing stops (I think).

    Try this: create a layer and create a simple position movement using two keyframes. Make the movement big and set keyframe 1 to frame 1 and keyframe 2 at frame 15. Add two more keyframes at 4 seconds and 6 seconds.

    Go to Dan Ebberts Motionscript bounce and overshoot page and grab the last expression on the page and drop it onto your position property. You should see the bounce and overshoot working.

    Now, if you drag keyframe 3 to 2 seconds, you should see the bounce stop abruptly at key3. I’m still working on the problem myself, so no solution to offer, but that might help you with yours.

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