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?
Thanks!