Page 1 of 1

decay after keyframe POSITION one axis only

Posted: August 26th, 2009, 8:43 am
by Varangian
I have this great expression (below) that creates a continue of motion and decay after the last keyframe in a position animation on a 3D layer.

Problem is I only want it to happen on the Y-axis (not the x, or z-xais)
can anyone help me out and modify this?

the expression as is:

n = position.numKeys;
if (n > 0){
t = time - position.key(n).time;
if (t > 0){
freq =8;
amplitude = 50;
decay = 2.0;

s = amplitude*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
e = amplitude*Math.sin(freq*t*1*Math.PI)/Math.exp(decay*t)

value + [s,e]
}else{
value
}
}else{
value
}

Re: decay after keyframe POSITION one axis only

Posted: August 26th, 2009, 2:35 pm
by kobyg
Try this:

Code: Select all

n = position.numKeys;
if (n > 0){
t = time - position.key(n).time;
if (t > 0){
freq =8; 
amplitude = 50; 
decay = 2.0; 

//s = amplitude*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t); 
e = amplitude*Math.sin(freq*t*1*Math.PI)/Math.exp(decay*t)

value + [0,e]
}else{
value
}
}else{
value
}
Koby.

Re: decay after keyframe POSITION one axis only

Posted: August 27th, 2009, 7:11 am
by Varangian
worked great. Thanks Koby!