Answered
check if a layer is outside the camera area
Hi, is there any way to check if a layer is outside the camera area ?
example
if(ouside){opacity=100}
else {opacity=0}
Thank !!!

Hi, is there any way to check if a layer is outside the camera area ?
example
if(ouside){opacity=100}
else {opacity=0}
Thank !!!

Depending on what you're doing, variable visible should be true if any of the bounding rectangle of your target layer appears within the camera view:
L = thisComp.layer("Target Layer");
w = thisComp.width;
h = thisComp.height;
r = L.sourceRectAtTime(time,false);
ul = L.toComp([r.left,r.top]);
ur = L.toComp([r.left+r.width,r.top]);
ll = L.toComp([r.left,r.top+r.height]);
lr = L.toComp([r.left+r.width,r.top+r.height]);
visible = ((ul[0] >=0 && ul[0] <= w) && (ul[1] >=0 && ul[1] <= h)) ||
((ur[0] >=0 && ur[0] <= w) && (ur[1] >=0 && ur[1] <= h)) ||
((ll[0] >=0 && ll[0] <= w) && (ll[1] >=0 && ll[1] <= h)) ||
((lr[0] >=0 && lr[0] <= w) && (lr[1] >=0 && lr[1] <= h));
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.