Forum Replies Created

  • Liam Carlin

    March 8, 2022 at 11:22 am in reply to: Scripting – Centre Mask on Shape Layer

    Thanks incredible, thank you Filip! It makes a lot of sense. Thanks for your time 👍

  • Liam Carlin

    March 8, 2022 at 4:20 am in reply to: Scripting – Centre Mask on Shape Layer

    Thanks Filip,

    That makes sense. I have previously used sourceRectAtTime(); on text layers before.

    However I don’t actually know how to implement this. Are you able to see where I am going wrong.

    Thanks,
    Liam

    app.beginUndoGroup("Undo Rectangle Mask");

    myLayer = app.project.activeItem.selectedLayers[i];

    newMask = myLayer.Masks.addProperty("ADBE Mask Atom");

    myProperty = newMask.property("ADBE Mask Shape");

    newMask.name = "Rectangle Mask";

    newMask.maskMode = MaskMode.ADD;

    myShape = myProperty.value;

    sr= myLayer.sourceRectAtTime();

    pts= [

    [sr.left, sr.top],

    [sr.left+sr.width, sr.top],

    [sr.left+sr.width, sr.top+sr.height],

    [sr.left, sr.top+sr.height],

    ];

    createPath(pts,[],[],true);

    myLayer.sr;

    myShape.vertices = [[myLayer.width,0],[0,0],[0,myLayer.height],[myLayer.width,myLayer.height]];

    myShape.inTangents = [[0,0],[0,0],[0,0],[0,0]];

    myShape.outTangents = [[0,0],[0,0],[0,0],[0,0]];

    myShape.closed = true;

    myProperty.setValue(myShape);

    app.endUndoGroup();

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