ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Unlink two layers after a certain time in After Effects

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Héctor Moreno
Unlink two layers after a certain time in After Effects
on Mar 1, 2017 at 10:04:37 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 &lt;= t) {
value + (p.value - p.valueAtTime(0));
}
else {
thisLayer.position.valueAtTime(t - thisComp.frameDuration);
}


Return to posts index

Dan Ebberts
Re: Unlink two layers after a certain time in After Effects
on Mar 1, 2017 at 10:16:11 pm

Try changing this:

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

to this:

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


Dan



Return to posts index

Héctor Moreno
Re: Unlink two layers after a certain time in After Effects
on Mar 1, 2017 at 10:22:36 pm

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]