Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Display Acceleration

  • Display Acceleration

    Posted by Paul Kamuf on April 5, 2017 at 2:11 pm

    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

    Dan Ebberts replied 9 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    April 5, 2017 at 5:06 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;

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy