Hello Dan,
with your expression you helped me a lot, this was exactly what I was looking for.
So I have an example animation of one square and one circle.
The square is moving from the left to the right:


Then down a little bit:

Then it goes back and the circle is coming with the square:

If the checkbox is ticked then the circle is moving with the square’s position (like in your expression). I just changed the point from when it is starting to move with the quare with a slider control (“Start”).

Now I want the circle to stop on that current position where it is now. And this I want to determine with the second slider control (“End”).
Has to be something like
if(time>End)
{
STAY AT YOUR CURRENT FCKNG POSITION!!!
}
else
{
I WILL KILL YOU
}
haha
So. The first part is done. How to stop that whole thing?
This is the code I used (translated in english for you):
myParent = thisComp.layer("Square");
myProp = myParent.transform.position;
Box = thisComp.layer("Adjustment Layer 1").effect("Checkbox")("Checkbox");
Start = thisComp.layer("Adjustment Layer 1").effect("Start")("Slider control");
End = thisComp.layer("Adjustment Layer 1").effect("End")("Slider control");
if(time>Start && Box==1)
{
value + (myProp.value - myProp.valueAtTime(Start))
}
else
{
value
}