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 < 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}