-
Expressions: bounce version of this overshoot Expression Selector code for text?
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 durationmyDelay = (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);
}