Automatically create an elliptical mask

What type of scripts do you need?

Moderator: byronnash

Post Reply
Elliott Kajdan
Posts: 1
Joined: September 30th, 2010, 9:17 am

Hello peolpe !

I use circle masks for everything when I color correct, Im trying to make this process :
http://help.adobe.com/en_US/aftereffect ... 6CA6a.html
as quick as possible.

I would love to make this as a script so I can call it with a keyboard shortcut, but I found very little info about masks and scripts...

All I could find was :

Code: Select all

newMask = thisLayer.Masks.addProperty("Mask");
Then I don't know

Code: Select all

myMaskShape = newMask.property("maskShape");
myShape = ?

Any help would be gladly appreciated !!

Thanks a lot

E.
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

This should add an elliptical mask to the selected layer:

Code: Select all

myLayer = app.project.activeItem.selectedLayers[0];
ratio = .5523;
h = myLayer.width/2;
v = myLayer.height/2;
th = h*ratio;
tv = v*ratio;
newMask = myLayer.Masks.addProperty("ADBE Mask Atom");
newMask.maskMode = MaskMode.ADD;
myProperty = newMask.property("ADBE Mask Shape");
myShape = myProperty.value;
myShape.vertices = [[h,0],[0,v],[h,2*v],[2*h,v]];
myShape.inTangents = [[th,0],[0,-tv],[-th,0],[0,tv]];
myShape.outTangents = [[-th,0],[0,tv],[th,0],[0,-tv]];
myShape.closed = true;
myProperty.setValue(myShape);

Dan
Post Reply