inertial bounce in effect to reaction to null position

Moderators: Disciple, zlovatt

Post Reply
benjaminbudzak
Posts: 1
Joined: November 11th, 2013, 4:46 pm

hey everyone, I am trying to set up an expression where the scale of a bunch of layers is controlled by a null object (closer = bigger), and that value has inertial bounce...i ghetto-rigged this from two of dan ebberts scripts, but it doesnt seem to work...can someone check this out and let me know what i need to fix please?

Code: Select all

//scale from null position
L = thisComp.layer("PlayerPos");
pct = 1;
r = 400;
p1 = toComp(anchorPoint);
p2 = L.toComp(L.anchorPoint);
d = length(p1,p2);
mult = ease(d,0,r,pct,0);
scaleAmt = value*(1+mult);

//intertial Bounce
rate = 500;
rampDur = scaleAmt/rate;
freq = 3;
decay = 5;
w = freq*Math.PI*2;
if (time < (inPoint+outPoint)/2){
  if (time < (inPoint + rampDur)){
    s = linear(time,inPoint,inPoint+rampDur,0, scaleAmt);
  }else{
    t = time - (inPoint+rampDur);
    s = scaleAmt + rate*Math.sin(t*w)/Math.exp(t*decay)/w;
  }
}else{
  if (time > (outPoint - rampDur)){
    s = linear(time,outPoint-rampDur,outPoint, scaleAmt,0);
  }else{
    t = (outPoint - rampDur) - time;
    s = scaleAmt + rate*Math.sin(t*w)/Math.exp(t*decay)/w;
  }
}
[s,s]
thanks for your help!
Post Reply