Activity › Forums › Adobe After Effects › How to add a Path to a shape layer by AE script
-
How to add a Path to a shape layer by AE script
Posted by Haider Najeeb on February 13, 2017 at 7:31 pmI am very beginner in AE script and I am trying to create a shape layer that contains rectangle and triangle shapes. I was able to add the rectangle by this line:
myRect= shapeGroup1.property("Contents").addProperty("ADBE Vector Shape - Rect");
and now I am trying to add the triangle by adding a path shape and draw three vertex but I have not found any resource explain how to do that. I tried to use same rectangle line and replace the “rect” with “path” but didn’t work.Haider Najeeb replied 9 years, 7 months ago 2 Members · 4 Replies -
4 Replies
-
Haider Najeeb
February 13, 2017 at 8:32 pmThank you Dave for your response! I was able to create a shape layer and first group “group1” and added a rectangle, and what I am trying to do now is to add a new group “group2” to the same shape layer “Contents” that I created and add a path container/element to this group “group2” and add three vertex mask to this “path”.
This is how I created first group and added rectangle to it:
var shapeLayer = newComp.layers.addShape(); // adding shape layer
shapeLayer.name = "bannerLayer"; // name the shape layer
var shapeGroup1 = shapeLayer.property("Contents").addProperty("ADBE Vector Group"); / creating a group1
shapeGroup1.name = "Banner"; //name the group1
myRect= shapeGroup1.property("Contents").addProperty("ADBE Vector Shape - Rect"); // adding rectangle to the group1
thanks you for your help
-
Haider Najeeb
February 13, 2017 at 11:19 pmI am working on creating a script that creates editable text that has an auto-expanded banner with a pointer (which is the path I am trying to figure out how to created by script) I have done 80% of this script successfully but I cant figure out how to generate this path by script. this image explains what I am trying to create:

on the left side of the image showing the path that I was talking about and on the right is the path highlightedHaider Najeeb
Art Director and Motion Designer
http://www.htn3d.com -
Walter Soyka
February 14, 2017 at 12:00 amThis should get you started:
// start with your code
var shapeLayer = newComp.layers.addShape(); // adding shape layer
shapeLayer.name = "bannerLayer"; // name the shape layer
var shapeGroup1 = shapeLayer.property("Contents").addProperty("ADBE Vector Group"); // creating a group1
shapeGroup1.name = "Banner"; //name the group1
myRect = shapeGroup1.property("Contents").addProperty("ADBE Vector Shape - Rect"); // adding rectangle to the group1// construct a Shape object that forms a triangle
var myTriShape = new Shape();
myTriShape.vertices = [[-50,50], [50,50], [0,100]];
myTriShape.closed = true;// add a Path group to our existing shape layer
myTriGroup = shapeLayer.property("Contents").addProperty("ADBE Vector Group"); // adding rectangle to the group1
myTriGroup.name = "Triangle";
myTri = myTriGroup.property("Contents").addProperty("ADBE Vector Shape - Group");// set the Path property in the group to our triangle shape
myTri.property("Path").setValue(myTriShape);Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive | RenderBreak [blog] | Profile [LinkedIn] -
Haider Najeeb
February 14, 2017 at 4:05 pmworked!! Thank you so much Walter! I really appreciate your help.. I was researching and asking for days and now you solved my dilemma 🙂
Haider Najeeb
Art Director and Motion Designer
http://www.htn3d.com
Reply to this Discussion! Login or Sign Up