Skip to main content
April 1, 2012
Answered

inverting an ellipse???

  • April 1, 2012
  • 1 reply
  • 1651 views

Hi,

i have some code that creates an ellipse to the size of my comp, now i just want to tweak some attributes of the ellipse, like inverting it (to create a vignette) and then bluring it.

this is the code so far:

var myComp = app.project.activeItem;

var myEllipseSize = [1920,1080];

var myFillColor = [0.0, 0.0, 0.0];

var myShapeLayer = myComp.layers.addShape();

var myShapeLayerContents = myShapeLayer.property("ADBE Root Vectors Group");

var myShapeGroup = myShapeLayerContents.addProperty("ADBE Vector Group");

var myEllipse = myShapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Shape - Ellipse");

myEllipse.property("ADBE Vector Ellipse Size").setValue(myEllipseSize);

var myShapeFill = myShapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Graphic - Fill");

myShapeFill.property("ADBE Vector Fill Color").setValue(myFillColor);

does anyone know how to now invert and blur this shape?

thanks,

Sam

This topic has been closed for replies.
Correct answer Dan Ebberts

This should do it:

var myComp = app.project.activeItem;

var w = myComp.width;

var h = myComp.height;

var ratio = .5523;

var hTan = ratio*w/2;

var vTan = ratio*h/2;

var mySolid = myComp.layers.addSolid([0,0,0], "vignette", w, h, 1);

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

newMask.maskMode = MaskMode.SUBTRACT;

newMask.property("Mask Feather").setValue([320,320]);

newMask.property("Mask Opacity").setValue(50);

newMask.property("Mask Expansion").setValue(170);

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

var myShape = myProperty.value;

myShape.vertices = [[w/2,0],[0,h/2],[w/2,h],[w,h/2]];

myShape.inTangents = [[hTan,0],[0,-vTan],[-hTan,0],[0,vTan]];

myShape.outTangents = [[-hTan,0],[0,vTan],[hTan,0],[0,-vTan]];

myShape.closed = true;

myProperty.setValue(myShape);

Dan

1 reply

Dan Ebberts
Community Expert
Community Expert
April 1, 2012

I'd be inclined to do it with a solid and an elliptical mask, like this:

var myComp = app.project.activeItem;

var w = myComp.width;

var h = myComp.height;

var ratio = .5523;

var hTan = ratio*w/2;

var vTan = ratio*h/2;

var mySolid = myComp.layers.addSolid([0,0,0], "vignette", w, h, 1);

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

newMask.maskMode = MaskMode.SUBTRACT;

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

var myShape = myProperty.value;

myShape.vertices = [[w/2,0],[0,h/2],[w/2,h],[w,h/2]];

myShape.inTangents = [[hTan,0],[0,-vTan],[-hTan,0],[0,vTan]];

myShape.outTangents = [[-hTan,0],[0,vTan],[hTan,0],[0,-vTan]];

myShape.closed = true;

myProperty.setValue(myShape);

var myBlur = mySolid.property("Effects").addProperty("Fast Blur");

myBlur.property("Blurriness").setValue(25);

myBlur.property("Repeat Edge Pixels").setValue(true);

Dan

April 1, 2012

wow this is great.

is there a way to effect the mask feathering and mask exansion of the solid rather than adding a blur to it? - i know that i need each the following settings:

mask feather: 320

opacity: 50

expansion: 170

is this possible?

Sam

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
April 1, 2012

This should do it:

var myComp = app.project.activeItem;

var w = myComp.width;

var h = myComp.height;

var ratio = .5523;

var hTan = ratio*w/2;

var vTan = ratio*h/2;

var mySolid = myComp.layers.addSolid([0,0,0], "vignette", w, h, 1);

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

newMask.maskMode = MaskMode.SUBTRACT;

newMask.property("Mask Feather").setValue([320,320]);

newMask.property("Mask Opacity").setValue(50);

newMask.property("Mask Expansion").setValue(170);

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

var myShape = myProperty.value;

myShape.vertices = [[w/2,0],[0,h/2],[w/2,h],[w,h/2]];

myShape.inTangents = [[hTan,0],[0,-vTan],[-hTan,0],[0,vTan]];

myShape.outTangents = [[-hTan,0],[0,vTan],[hTan,0],[0,-vTan]];

myShape.closed = true;

myProperty.setValue(myShape);

Dan