Adding this to a preset in AE

Moderators: Disciple, zlovatt

Post Reply
Posts: 1
Joined: March 22nd, 2016, 12:36 pm


I use this script/expression (I really don't know the difference) all the time. I currently have it in notepad and copy and paste it into almost everything that can have a bounce property. So when I try and make it a preset or add it to my script library it won't work. If I add it to my script library and then apply it to a property it gives me this error: "unable to execute script at line 3. numKeys is undefined". If I make it a preset and then apply it to a property it only works for the property that I pasted into originally. For example I pasted the script into the scale property of a layer then Went to Animation>Save Animation Preset. Save it and then drag it onto my new layer it only applies it to the Scale property. How do I make it universal to just apply it to whatever property I highlight? Is this the right way to do it? Also I do get a yellow or orange banner that pops up in in the comp window telling me that there is an error in the expression but it still works I just get the error.

I am not sure who wrote this script but I found it a while ago and I use it alllll the time.

// Inertial Bounce (moves settle into place after bouncing around a little)
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
if (n == 0){
t = 0;
t = time - key(n).time;

if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
amp = .05;
freq = 4.0;
decay = 6.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
Post Reply