-
Move mask depending on accuracy of MotionTracker
Hi —
I’m new to scripting in AE and am looking for some help with an expression to help me automatically move a layer into or out of frame depending on the accuracy of a motionTracker attach point.I want the script to check the attachPoint’s position and if it falls within an acceptable range of values then the targeted layer will remain in place. If it falls outwith that range, the targeted layer will move to a different position (out of frame, basically).
My problem: How can I specify the range of acceptable values in a way AE likes? My inclination is that I will need to use an interpolation expression…
For what it’s worth, this is what I have so far. Try not to laugh… it’s incomplete, I know, the ‘range’ aspect (leeway) of this expression is half-baked — any help is hugely appreciated.
layerHome = [960,540]; // target layer's home position xTarget = [1230,152]; // the 'perfect' position for attach point trkrAttach = thisComp.layer("Cam10").motionTracker("Tracker 1")("Track Point 1").attachPoint; //attach point's real value leeway = 10; // range in pixels acceptable for xTarget to deviate if (trkrAttach != xTarget){ this_layer.position = [3000,3000] } else { this_layer.position = layerHome; }Rugged yet hygienic.