ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Inertia Bounce Decay issue

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Brad Pickford
Inertia Bounce Decay issue
on Aug 3, 2015 at 4:11:42 pm

Hi all,
I have been using this expression for years but I have only just stumbled on tis issue. I have an object swinging and as it hits the last keyframe I want it to sway for while (more than one second). When I change the decay value it clips at 1 second from last keyframe. I have included a screenshot of the graph editor where you can see how it stops. Is there a way of changing the expression so that it can decay over periods greater than 1 second?



Cheers!

amp = .1;
freq = 2.0;
decay = 2.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 && t &lt; 1){
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


Dan Ebberts
Re: Inertia Bounce Decay issue
on Aug 3, 2015 at 4:32:58 pm

Try changing this line:

if (n > 0 && t < 1){

to this:

if (n > 0 && t < 15){


Dan



Return to posts index

Brad Pickford
Re: Inertia Bounce Decay issue
on Aug 4, 2015 at 12:03:29 am

As always, PERFECT! Thanks so much Dan!


Return to posts index


JP Pelc
Re: Inertia Bounce Decay issue
on Jan 24, 2017 at 9:24:25 pm

Dan you are a true hero


Return to posts index

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