Activity › Forums › Adobe After Effects Expressions › Mask size(width x hight)via script
-
Mask size(width x hight)via script
Tudor Baican replied 4 years, 3 months ago 6 Members · 12 Replies
-
Dan Ebberts
February 14, 2022 at 3:17 amI suppose you could create a shape layer (with a single click of the pen tool) and link its path to the mask with an expression. You could then get the dimensions with sourceRectAtTime(), and even turn the eyeball off for the shape layer so it doesn’t show up in the comp.
-
Tudor Baican
February 15, 2022 at 1:23 pmI tried now to realize your idea in this feed from April 8, 2007.
I iterate through the path and collect all min and max values.
myPath = thisComp.layer("Shape Layer 1").mask("Mask 1").maskPath.points();
xValues = [];
yValues = [];
for (i in myPath){
xValues.push(myPath[i][0]);
yValues.push(myPath[i][1]);
};
width = Math.max(...yValues) - Math.min(...yValues);
height = Math.max(...xValues) - Math.min(...xValues);
left = Math.min(...xValues);
top = Math.min(...yValues);
Reply to this Discussion! Login or Sign Up