FORUMS: list search recent posts

How do I add an Ellipse shape to a Comp with script?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mattias Svendsen
How do I add an Ellipse shape to a Comp with script?
on Sep 27, 2011 at 9:46:01 am

How do I create an Ellipse shape in a Comp with script? Can I access and create an Ellipse property with parameters or do i have to create it point by point?
Can't find anything about the syntax of creating shapes so any hints or examples would be great. Ive understood that you can create path points with Arrays but i havn't found an example.

Fail //shapeLayer.property("Contents").addProperty("Ellipse");
Fail //shapeLayer.property("Contents").addProperty("Ellipse 1");


Return to posts index


Dan Ebberts
Re: How do I add an Ellipse shape to a Comp with script?
on Sep 27, 2011 at 10:29:14 pm

Like this:


var myComp = app.project.activeItem;

var myEllipseSize = [100,200];
var myFillColor = [0.5, 0.5, 1.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);



Dan



Return to posts index

Mattias Svendsen
Re: How do I add an Ellipse shape to a Comp with script?
on Sep 28, 2011 at 9:37:12 am

Excellent! Exactly what i needed to know. Thank you, Dan.

Is there any official information about the property ADBE Root Vector Groups? Google returns only one hit. The aftereffectscs3_scripting_guide.pdf mentions it tangentially as "This is the same as using a shape tool in "Tool Creates Shape" mode. Tools automatically add a vector group that includes Fill and Stroke as specified in the tool options." This is all i've found. How did you learn of it?

I need several rings so this is what i use. I'll wrap it in a function later.
var myEllipseSize = [70,70];
var myStrokeWidth = [4];
var myStrokeColor = [1, 0, 0];

var shapeLayer2 = compShot.layers.addShape();
var shapeLayer2Contents = shapeLayer2.property("ADBE Root Vectors Group");

var myShapeGroup = shapeLayer2Contents.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 myShapeStroke = myShapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Graphic - Stroke");
myShapeStroke.property("ADBE Vector Stroke Width").setValue(myStrokeWidth);
myShapeStroke.property("ADBE Vector Stroke Color").setValue(myStrokeColor);

var myShapeGroup = shapeLayer2Contents.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 myShapeStroke = myShapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Graphic - Stroke");
myShapeStroke.property("ADBE Vector Stroke Width").setValue(myStrokeWidth);
myShapeStroke.property("ADBE Vector Stroke Color").setValue(myStrokeColor);


Keywords: Create Add ADBE Vector Ellipse Graphic Shape Group Stroke addProperty Script


Return to posts index


Dan Ebberts
Re: How do I add an Ellipse shape to a Comp with script?
on Sep 28, 2011 at 11:10:19 am

I learned it mostly by using Jeff Almasol's rd_GimmePropPath script (http://www.redefinery.com/ae/view.php?item=rd_GimmePropPath) to get the match names of all the shape properties.

Dan



Return to posts index

Mattias Svendsen
Re: How do I add an Ellipse shape to a Comp with script?
on Sep 28, 2011 at 11:55:19 am

Gimme Prop Path should be a permanent part of After Effects! Thanks for pointing out this invaluable tool for scripters :)


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]