-
masking video clips automatically – issues
I made a giant collage of rectangles and have a source below each rectangle, using that rectangle as a mask.
I’m auto sizing the sources by assigning the position to the layer above first, then since they are actual rectangles, just doing rectangle height / source.height *100.
I added the ability to mirror the footage as well, but that’s basically it.
But then I wanted to be able to pan and scale the footage further to get the right crop for each, so added a transform modifier. And that’s where I failed. I was Hoping I could create some limits there. I tried using sourceRectAtTime and compare this layer left with the rectangle left. I thought that would take the actual contents into consideration, but it seems that it’s ignoring the transform effect?
I have an adjustable stroke between all of the footage, currently at 10px. What I was hoping to avoid was me not noticing that when I adjusted the transform of the footage, accidentally leaving something like 12-14px on one side and not noticing. It’s a collage of 151 rectangles, so that leaves plenty of space for human error.
In me trying to put it together, this is as far as I got before thinking maybe sourceRectAtTime doesn’t work with effects? My next attempt will be adding an expression slider for adding X, then adding that value to the position of the layer, avoiding the transform altogether, and see if that will work. OR, maybe one of you gurus will see a glaring error in how I’m trying to write this.
____on a transform effect > Position____
maskLayer = thisComp.layer(index-1);
maskL = maskLayer.sourceRectAtTime().left;
maskW = maskLayer.sourceRectAtTime().width;
maskR = maskL + maskW;
thisL = thisLayer.sourceRectAtTime(includeExtents = true).left;
thisW = sourceRectAtTime().width;
thisR = thisL + thisW;
reset = effect("Transform")("Anchor Point");
if(thisL < maskL){x = maskL;}
else if(thisR > maskR){x = maskR;}
else x = effect("Transform")("Position")[0];
y = effect("Transform")("Position")[1];
[thisL,y]