Page 1 of 1

Automatically create an elliptical mask

Posted: April 20th, 2012, 9:31 am
by Elliott Kajdan
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.

Re: Automatically create an elliptical mask

Posted: April 20th, 2012, 2:46 pm
by Dan Ebberts
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