-
Display Acceleration
Hi,
I want to display the acceleration value of an animating x property. I also want to change the color when it’s over a certain value. There is probably a very easy way to do it, maybe AE already has an acceleration value, but here is what I have so far.
Animating layer has sliders that get the x position, previous x position and next x position. Then I pass those to a text layer and calculate difference in velocity and acceleration.
Sliders are using an expression like this:
Slider 1 -> transform.position.valueAtTime(time-(1/30))[0];
Slider 2 -> transform.position[0];
Slider 3 – > transform.position.valueAtTime(time+(1/30))[0];Text layer has source text expressions something like the below code.
Any thoughts? (I ran into problems when trying to get x position or velocity at time from a second layer. )
Thank you,
Paul//gets values from slider
s1 = thisComp.layer("CONTROL").effect("PREV")("Slider")
s2 = thisComp.layer("CONTROL").effect("CURRENT TIME")("Slider")
s3 = thisComp.layer("CONTROL").effect("NEXT")("Slider")
v = (s2-s1)*30
w = (s3-s2)*30
w-v*30