ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How to add a Path to a shape layer by AE script

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Haider Najeeb
How to add a Path to a shape layer by AE script
on Feb 13, 2017 at 7:31:52 pm

I 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.


Return to posts index

Dave LaRonde
Re: How to add a Path to a shape layer by AE script
on Feb 13, 2017 at 8:00:12 pm

I'm not sure what you want. Do you want two different shapes in one shape layer at the same time? That can't be done.
I don't know if there's a piece of triangle code. I assume you want to morph a rectangle into a triangle or vice-versa.

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index

Haider Najeeb
Re: How to add a Path to a shape layer by AE script
on Feb 13, 2017 at 8:32:39 pm

Thank 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


Return to posts index


Dave LaRonde
Re: How to add a Path to a shape layer by AE script
on Feb 13, 2017 at 10:25:23 pm

Sorry, but I still don't know what you're trying to accomplish. What will the viewer see when you are done?

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index

Haider Najeeb
Re: How to add a Path to a shape layer by AE script
on Feb 13, 2017 at 11:19:24 pm

I 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 highlighted

Haider Najeeb
Art Director and Motion Designer
http://www.htn3d.com


Return to posts index

Walter Soyka
Re: How to add a Path to a shape layer by AE script
on Feb 14, 2017 at 12:00:49 am

This 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 [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index


Haider Najeeb
Re: How to add a Path to a shape layer by AE script
on Feb 14, 2017 at 4:05:44 pm

worked!! 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


Return to posts index

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