Activity › Forums › Adobe After Effects Expressions › Inertia expression keeps turning itself off
-
Inertia expression keeps turning itself off
Ale Elizondo replied 11 years, 6 months ago 7 Members · 15 Replies
-
Ale Elizondo
February 4, 2015 at 10:46 pmThere is an error on this line :/:
“Class global has no property or method named “t”
-
Dan Ebberts
February 4, 2015 at 10:51 pmAh yes, sorry.
you need to also move the definition of t outside the conditional. So change this:
if (n == kf){
t = time – key(n).time;to this:
t = time – key(n).time;
if ((n == kf) && (t < 5)){Dan
-
Dan Ebberts
February 4, 2015 at 10:59 pmNah, that’s not going to work either. Give me a minute…
Dan
-
Dan Ebberts
February 4, 2015 at 11:05 pmThat’s what I get for not testing it. This should work:
amp = .2;
freq = 3;
decay = 2;
kf = 2; // only on 2nd keyframe
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time) n--;
}
if (n == kf){
t = time - key(n).time;
if (t < 5){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
temp = value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
x = temp[0];
y = value[0]*value[1]/x;
[x,y]
}else{
value
}
}else
value
Dan
-
Ale Elizondo
February 5, 2015 at 3:53 pmHow forever thanks Dan!!! 😀 this works perfect and you saved me a lot of time and problems.
Reply to this Discussion! Login or Sign Up