I have the following expression on the position of a layer that makes it follow another layer(FollowNull). Basically, I set an initial position with a PointController and the expression does it's magic.

s = effect("Speed")("Slider");
p1 = effect("InitialPosition")("Point");
p2 = thisComp.layer("FollowNull").transform.position;
d = (length(p1,p2))/s;
t = (time - inPoint)%d;

linear(t, 0, d, p1, p2);

The problem is when I actually start moving (keyframing) the FollowNull layer, the speed changes. I'm assuming it is because the distance between both layers is only calculated once, so the travel time stays the same, even if one layer is going away from the other.

Any idea how I can fix this behaviour?



1 Answer 1


From this tutorial, if you parent one layer's position to another's position, you can use an expression like this to follow the first layer:

thisComp.layer("red star").transform.position.valueAtTime(time-0.5)
  • That would work great if I wanted them to follow the exact same path, but that's not quite what I'm looking for. The following layer should be moving towards the layer being followed independent of that actual layer's movement.
    – JoaoB
    Commented Apr 26, 2023 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.