-
Speed control with parallax
Hello, I use the well-known expression of Dan Ebbert to control the scrolling of a layer in a composition. This expression is:
spd = thisComp.layer("SPEED CONTROL").effect("Layer speed control")("Slider");
n = spd.numKeys;
if (n > 0 && spd.key(1).time < time){
accum = spd.key(1).value*(spd.key(1).time - inPoint);
for (i = 2; i <= n; i++){
if (spd.key(i).time > time) break;
k1 = spd.key(i-1);
k2 = spd.key(i);
accum += (k1.value + k2.value)*(k2.time - k1.time)/2;
}
accum += (spd.value + spd.key(i-1).value)*(time - spd.key(i-1).time)/2;
}else{
accum = spd.value*(time - inPoint);
}
value + accumNow, I would like to add a parallax effect and add a second layer behaving exactly the same way but 20% faster than the one in the background. And I don’t know where I can enter this factor in the expression. Can you help me please ?
I first tried to connect the controller at the beginning of the expression to another controller, itself connected by expression to the first with an “x 1.2” but suddenly I have a problem on the deceleration that Dan mentions at the beginning of his article here: https://www.motionscript.com/articles/speed-control.html
Thanks
motionscript.com
Expression Speed and Frequency Control
Dan Ebberts's resource for After Effects scripting and expressions