Copy link to clipboard
Copied
Hello Adobe comunity. I am struggling with an AE expression that I just don't know what to do! I use AE all the time at work but I am just now getting into using expressions. I picked up this Inertial Bounce online and it is working great on all my images (AI layers) with the exception of one. Ugh. I have tried deleting the layers and re importing, rendering the layer as a .png and applying the expressions, and restarting the program. I'm not sure what is going on here?
My process:
Import AI file as a comp/Document Size
Open comp/ select layer and create keyframes at 0;00;00;00 and 0;00;00;05
go to keyframe at 0;00;00;00 and set Scale to 0% and add easy ease out
hold down alt + left mouse click to open expression and copy and paste this code:
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);
amp = .05;
freq = 4.0;
decay = 8.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}
I immediately get this error:
I would appreciate any help I can get on this issue!
It looks like the expression got mangled somewhere along the line. Try it this way:
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);
amp = .05;
freq = 4.0;
decay = 8.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}
Dan
Copy link to clipboard
Copied
It looks like the expression got mangled somewhere along the line. Try it this way:
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);
amp = .05;
freq = 4.0;
decay = 8.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}
Dan
Copy link to clipboard
Copied
Thanks so much Dan! Your a life saver