Offset in time and Inertial Bounce Expressions together
Hi.
I have a problem where I would like to control Offset in time and Inertial Bounce Expressions together on a layer which is connected to a null. Here is my expression so far:
// Expression below makes the Offset in time
offset = thisComp.layer("CONTROL LAYERS").effect("Slider Control")("Slider"); //The offset in time, negative half a second.
p = thisComp.layer("Null 12"); //The parent layer
T = time + offset; //The current time minus half a second
p.position.valueAtTime(T); //Value of the parent's position property at the current time minus half a second
// Expression below makes the Inertial Bounce
x = thisComp.layer("Null 12").transform.position;
n = 0;
if (x.numKeys > 0){
n = x.nearestKey(time).index;
if (x.key(n).time > time) n--;
}
if (n == 0){
t = 0;
}else{
t = time - x.key(n).time;
}
if (n > 0){
v = x.velocityAtTime(x.key(n).time - thisComp.frameDuration/10);
amp = .02;
freq = 2.0;
decay = 4;
x.value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
x.value;
}
Any Idea how to make these two expressions work sametime together?
-Matti
