-
Adding “Time Offset” to a selected layer via the Layer control expression
Hi All,
I’ve come up against a wall Im hoping someone may be able to help me get over. I’ve got a camera rig which I have a small expression control set up on a null. The controls null has a ‘Target active’ (checkbox), ‘Target layer’ (layer control) and ‘Time offset” (slider control).
The point of the control is a have the ability to easily select between layers within the comp from the layer control for the camera to target, then the ability to add time offset to delay any animation on the camera following the selected layer. While also easily deactivating the target active to have the camera free from the targeting system.
My expression so far works when I have just the layer control controlling the selected layer but when I add the time offset into the equation, its error city.
Can anyone help me out? I know its got to do with the array of the selected layer, though Im not entirely sure how to use that information within the valueAtTime(t) in this current set up.
Any help Id greatly appreciate. Thanks!
try{
L = thisComp.layer("Null 10").effect("Layer Control")("Layer");
target = L.toWorld(L.anchorPoint);
}catch(err){
target = value;
}tarActive = thisComp.layer("Null 10").effect("Checkbox Control")("Checkbox");
tOffset = thisComp.layer("Null 10").effect("Slider Control")("Slider");
t = time + tOffset;
POI = target.position.valueAtTime(t);if (tarActive==1) {POI} else {value}