Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Rotation On Off from other layer position

  • Rotation On Off from other layer position

    Posted by Madli Man on December 19, 2012 at 3:58 am

    hi all,

    i very new to expression. i found this expression and i would like to put in y rotation.
    how can i modify it to stay to last value once it hit zero.

    if layer(“Avoid Me”) is far away, value y rotation is 100. if result 0, rotation is 0 and never affected with layer(“Avoid Me”) anymore.

    please help me sir.

    thank you.

    D_opaq =10
    D_trans = 150;
    d = length(position, thisComp.layer("Avoid Me").transform.position);
    result = ease(d, D_opaq, D_trans, 100, 0);
    [result]
    if(result==0){
    [0]
    }

    Madli Man replied 13 years, 4 months ago 2 Members · 3 Replies
  • 3 Replies
  • Madli Man

    December 19, 2012 at 4:35 pm

    anyone help me?

  • Dan Ebberts

    December 19, 2012 at 5:28 pm

    It’s a little tricky. You have to go back in time, frame-by-frame to see if the layers were ever close enough together to force the output to zero (I used a threshold of .5 pixels in this example–you may need to adjust it). So I think it would be like this (I had to flip the 0 and 100 values in your ease() statement to get it to work as you described):


    D_opaq =10;
    D_trans = 150;
    D_threshold = .5;

    f0 = timeToFrames(inPoint);
    for (f = timeToFrames(time); f >= f0; f--){
    t = framesToTime(f);
    d = length(position.valueAtTime(t), thisComp.layer("Avoid Me").transform.position.valueAtTime(t));
    trigger = d < D_threshold;
    if (trigger) break;
    }
    if (! trigger){
    d = length(position, thisComp.layer("Avoid Me").transform.position);
    ease(d, D_opaq, D_trans, 0, 100);
    }else
    0

    Dan

  • Madli Man

    December 19, 2012 at 5:40 pm

    Thank you Mr.Dan, this help me alot. it works. it just i need to be careful with pixel if match with threshold. I dont really know how it works, but im trying to get the logic now. 🙂

    Thank you sir. God bless you.

    Madlim

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