ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Inertial Bounce at Start AND End?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Brent Taylor
Inertial Bounce at Start AND End?
on Mar 7, 2017 at 9:31:11 pm

I've been using this expression for a while to do the Inertial bounce effect (from Graymachine's site... expression below). It's really useful. I'd really like to figure out a variation that does it not only does the effect at the end keyframe, but also in reverse at the beginning.

The closest I've found is the "Elastic" effect in the Ease and Wizz plugin that many of you are familiar with. I won't post the code here out of courtesy to the developers, but it is currently "pay what you want" so there's no barrier to checking it out to see what I mean. That one does exactly what I'm looking for, but it's broken... if you have two identical keyframes (in order to make a space where something stays still) it adds a bunch of extra twitching in the middle that shouldn't be there. I need to be able to have things hold still. There's workarounds (splitting layers, etc) but that ends up being more trouble than the expression saves me.

Does anyone have any ideas how to do it? I've spent a lot of time trying to figure it out and am just stumped.

amp = .1;
freq = 2.0;
decay = 2.0;
n = 0;
time_max = 4;
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 && t < time_max){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{value}


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]