Adobe After Effects User Manual
Page 709

Expression example: Start or stop wiggle at specific time
You can use any expression in place of the wiggle expression used here, to begin and end the influence of any expression at a specific time.
Apply the following expression to a property to wiggle it beginning at time 2 seconds:
timeToStart = 2;
if (time > timeToStart)
{
wiggle(3,25);
}
else
{
value;
}
Apply the following expression to a property to stop wiggling it at time 4 seconds:
timeToStop = 4;
if (time > timeToStop)
{
value;
}
else
{
wiggle(3,25);
}
Apply the following expression to a property to start wiggling it at time 2 seconds and stop wiggling it at time 4 seconds:
timeToStart = 2;
timeToStop = 4;
if ((time > timeToStart) && (time < timeToStop))
{
wiggle(3,25);
}
else
{
value;
}
Expression example: Match camera focal plane to another layer
Apply the following expression to the Focus Distance property of a camera layer to have its focus distance match the distance to the anchor
point of a layer named “target”:
target = thisComp.layer("target");
V1 = target.toWorld(target.anchorPoint) - toWorld([0,0,0]);
V2 = toWorldVec([0,0,1]);
dot(V1,V2);
Dan Ebberts explains this expression example in detail on his
Adobe also recommends
705