Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Calculating overshoot for a linear expression that’s referencing another layer

  • Calculating overshoot for a linear expression that’s referencing another layer

    Posted by Marissa Joyner on May 6, 2016 at 5:10 pm

    Hi!

    I hope someone can help me with this because it’s driving me nuts!

    I have a set of layers that rotate from 180-0 based on another layer’s X position plus or minus the rotating layer’s position. In other words, as the moving layer approaches the rotating layer’s position it starts to rotate then completes the rotation once the moving layer gets past a certain point.

    I have this expression on the rotating layers’ Y rotation property:

    ease(thisComp.layer(“movement”).transform.position[0], transform.position[0]-400, transform.position[0]+240, 180,0);

    I’d like an overshoot expression added to the Y rotation property. But as you can see the Y rotation is driven by a linear expression and inside the linear expression I’m referencing another layer’s position (which is keyframed). So, I’m guessing the overshoot can’t be based on time (time-inPoint) and the overshoot can’t be based on keyframes because the Y rotation isn’t keyframed?

    I was trying to play with this expression from Dan Ebbers site but I couldn’t figure out how to make it work with my current set up

    freq = 3;
    decay = 5;

    t = time – inPoint;
    startVal = [0,0];
    endVal = [200,200];
    dur = 0.1;
    if (t < dur){
    linear(t,0,dur,startVal,endVal);
    }else{
    amp = (endVal – startVal)/dur;
    w = freq*Math.PI*2;
    endVal + amp*(Math.sin((t-dur)*w)/Math.exp(decay*(t-dur))/w);
    }

    Maybe it’s lack of sleep but I can’t wrap my brain around this problem… maybe it’s just not possible?

    Thanks in advance to anyone who can help!

    freq = 3;
    decay = 5;

    t = time - inPoint;
    startVal = [0,0];
    endVal = [200,200];
    dur = 0.1;
    if (t &lt; dur){
    linear(t,0,dur,startVal,endVal);
    }else{
    amp = (endVal - startVal)/dur;
    w = freq*Math.PI*2;
    endVal + amp*(Math.sin((t-dur)*w)/Math.exp(decay*(t-dur))/w);
    }

    After Effects template maniac
    https://www.fluxvfx.com/

    Dan Ebberts replied 10 years, 2 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    May 6, 2016 at 6:28 pm

    It is a little bit tricky because you don’t have direct access to the info you need for the calculation.

    First thing though, I don’t think you want to use ease() in your expression, because at the end of ease (or easeOut) there’s no velocity available to generate any overshoot. easeIn or linear should work better.

    For the calculation itself, the information you need is the time when the rotation reached zero, and what the velocity of the rotation was at that time. Certainly do-able, but a bit of work to set up.

    Dan

  • Marissa Joyner

    May 6, 2016 at 7:05 pm

    Yeah that’s gonna be…tricky.
    I want to vary the timing of the X position keyframes too so nailing down the time when rotation reaches 0 seems like a bit too much calculating for this project. Oh well. Overshoot is one of those things in this project that would be nice to have but not completely necessary.
    I appreciate your quick response Dan!

    After Effects template maniac
    https://www.fluxvfx.com/

  • Dan Ebberts

    May 6, 2016 at 7:10 pm

    Assuming that the x position is only traveling one direction, once the rotation reaches zero degrees, you could back up, frame by frame to find out when it reached zero, use that time, t, and t-.001 to calculate the velocity of the rotation when it reached zero and then use that in your overshoot expression.

    Dan

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