Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Mask size(width x hight)via script

  • Dan Ebberts

    February 14, 2022 at 3:17 am

    I 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 pm

    I 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);
Page 2 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy