Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Unlink two layers after a certain time in After Effects

  • Unlink two layers after a certain time in After Effects

    Posted by Héctor Moreno on March 1, 2017 at 10:04 pm

    I want to have a layer (let’s call it Leader) that moves and another one (let’s say Follower) whose position is linked to the first one’s, so it will have the same movement, but at a specific time t it should “unlink” from the first layer and stay in that position.

    But for some reason I don’t understand, at time t, the Follower goes back to its original position instead of staying in the place in which it was “unlinked” from the Leader. What am I missing?

    My idea is that, when trying to get the Follower‘s position, I am getting the original position, not the values that are changed according to the Leader‘s position, even though I tried to get the value from the previous frame, but I don’t know how to get the modified values of the position.

    Here’s the closest I’ve come to getting it right:

    var pos = value;
    var p = thisComp.layer("Leader").transform.position;
    t = 1; // Unlink after 1 second
    if (time <= t) {
    value + (p.value - p.valueAtTime(0));
    }
    else {
    thisLayer.position.valueAtTime(t - thisComp.frameDuration);
    }

    Héctor Moreno replied 9 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    March 1, 2017 at 10:16 pm

    Try changing this:

    thisLayer.position.valueAtTime(t – thisComp.frameDuration);

    to this:

    value + (p.valueAtTime(t) – p.valueAtTime(0));

    Dan

  • Héctor Moreno

    March 1, 2017 at 10:22 pm

    That worked just as I wanted, thank you very much!

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