ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Display Acceleration

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Paul Kamuf
Display Acceleration
on Apr 5, 2017 at 2:11:07 pm
Last Edited By Paul Kamuf on Apr 5, 2017 at 4:09:08 pm


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,

//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

Return to posts index

Dan Ebberts
Re: Display Acceleration
on Apr 5, 2017 at 5:06:42 pm

If I was calculating x acceleration, I think it would look like this:

myProp = thisComp.layer("target").transform.position;
v1 = myProp.velocityAtTime(time-.01)[0];
v2 =myProp.velocity[0];
acc = (v2 - v1)*100;


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved