Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Adding Shapes with ExtendScript

  • Adding Shapes with ExtendScript

  • Ronan De Lacy

    January 21, 2021 at 12:49 pm

    Hello,

    I’m trying to add a a path with a stroke housed in a group. I can create the group and the path inside it, however when I try to add a stroke to the group everything breaks. Can anyone point me in the right direction? I’ve been looking at this for hours and can’t figure out where I’m going wrong.

    Any help greatly appreciated.

    Many thanks!

    var addLayer = app.project.item(5).layers;

    var addGrid = addLayer.addShape();

    addGrid.label = (13);

    addGrid.name = ("headline-text-grid");

    var group = addGrid.content.addProperty("ADBE Vector Group");

    group.name = "P1";

    var myShapeGroup = group.content.addProperty("ADBE Vector Shape - Group");

    myShapeGroup.addProperty("ADBE Vector Graphic - Stroke");//This line breaks everything

    var myShape = new Shape();

    myShape.vertices = [[-compWidth/2,-compHeight/2],[compWidth/2,-compHeight/2]];

    myShape.closed = false;

    // set the value of the path too the shape object

    myShapeGroup.property("ADBE Vector Shape").setValue(myShape);

  • Ronan De Lacy

    January 21, 2021 at 1:10 pm

    Crisis averted. I moved the add stroke to the bottom of the stack and placed it within it’s own variable. See below for fix

    var addLayer = app.project.item(5).layers;

    //Add Headline Grid

    var addGrid = addLayer.addShape();

    addGrid.label = (13);

    addGrid.name = ("headline-text-grid");

    var group = addGrid.content.addProperty("ADBE Vector Group");

    group.name = "P1";

    var myShapeGroup = group.content.addProperty("ADBE Vector Shape - Group");

    var myShape = new Shape();

    myShape.vertices = [[-compWidth/2,-compHeight/2],[compWidth/2,-compHeight/2]];

    myShape.closed = false;

    // set the value of th path too the shape object

    myShapeGroup.property("ADBE Vector Shape").setValue(myShape);

    var stroke = group.content.addProperty("ADBE Vector Graphic - Stroke"); // add a stroke

Viewing 1 - 2 of 2 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy