Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Scripting – how to copy a mask shape?

  • Scripting – how to copy a mask shape?

    Posted by James Primhak on November 4, 2010 at 3:32 pm

    Hi guys,

    I am trying to write a script to copy masks from one solid to several other newly created solids. I have read Dan’s tutorials on scripting and found them really useful, and have tried to get to grips with the AE Scripting Guide, but this is something I am really struggling with. How would you simply copy the mask shape of one mask to a mask on another solid?

    I know this is probably very elementary, but I’ve been surprised at how little information there is on the internet regarding scripting. Are there any other sources of info/tutorials anyone recommends?

    Thanks in advance,

    Jim

    Robert Szilagyi replied 8 years, 10 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    November 4, 2010 at 9:07 pm

    Try this:

    var myComp = app.project.activeItem;

    var mySourceLayer = myComp.layer(“Source”);
    var myPath = mySourceLayer.property(“Masks”).property(“Mask 1”).property(“Mask Path”);
    var myShape = myPath.value;

    var myDestLayer = myComp.layer(“Dest”);
    var myNewMask = myDestLayer.property(“Masks”).addProperty(“Mask”);
    var myNewPath = myNewMask.property(“Mask Path”);
    myNewPath.setValue(myShape);

    Dan

  • James Primhak

    November 5, 2010 at 2:18 pm

    Cheers Dan, that’s awesome. I was on the right track, but I was doing a couple of things wrong. Your post has helped a lot. Thanks again.

    Jim

  • Robert Szilagyi

    July 13, 2017 at 3:15 pm

    Hi Dan,

    Is there a similar method, to delete all masks from a given layer?

    thanks!
    robert

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