Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Extendscript – Adding a vector shape to a group.

  • Extendscript – Adding a vector shape to a group.

    Posted by Billy Sides on December 20, 2017 at 5:02 pm

    I need help figuring out how to add the shape to a group. I need access to the group transforms so I can position each of the paths I am creating.

    Here is an image of what I would like to achieve.
    https://drive.google.com/file/d/1OEzRtp1ILlZR7L5T_7BPfk-JlYiaQRPg/view?usp=sharing

    var sVerts= [[-4.66796875,-4.614013671875],[-4.66796875,-1.584716796875],[4.701171875,-1.584716796875],[8.44921875,1.823486328125],[8.44921875,3.798095703125],[4.701171875,7.206298828125],[-4.66796875,7.206298828125],[-8.44921875,3.798095703125],[-8.44921875,3.387939453125],[-5.3125,2.809814453125],[-5.3125,4.512939453125],[5.283203125,4.512939453125],[5.283203125,1.208251953125],[-4.048828125,1.208251953125],[-7.833984375,-2.199462890625],[-7.833984375,-3.797607421875],[-4.048828125,-7.206298828125],[4.498046875,-7.206298828125],[8.283203125,-4.072998046875],[8.283203125,-3.729248046875],[5.248046875,-3.082275390625],[5.248046875,-4.614013671875]];
    var sITans= [[0,0],[0,0],[0,0],[0,-2.7265625],[0,0],[2.86328125,0],[0,0],[0,2.693359375],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,2.728515625],[0,0],[-2.83203125,0],[0,0],[0,-2.51806640625],[0,0],[0,0],[0,0]];
    var sOTans = [[0,0],[0,0],[0,0],[0,-2.7265625],[0,0],[2.86328125,0],[0,0],[0,2.693359375],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,2.728515625],[0,0],[-2.83203125,0],[0,0],[0,-2.51806640625],[0,0],[0,0],[0,0]];
    logoShapeLayer = activeItem.layers.addShape();
    logoShapeLayer.name="S Path";
    sShapeGroup = logoShapeLayer.property("ADBE Root Vectors Group");
    sShapeGroup.addProperty("ADBE Vector Shape - Group");
    logoShapeGroup.addProperty("ADBE Vector Graphic - Fill");

    var sShape = new Shape();
    sShape.vertices = sVerts;
    sShape.inTangents = sITans;
    sShape.outTangents = sOTans;
    sShape.closed = true;

    sShapeGroup.property(1).property("ADBE Vector Shape").setValue(sShape);

    -bsides

    Billy Sides replied 8 years, 4 months ago 1 Member · 1 Reply
  • 1 Reply
  • Billy Sides

    January 3, 2018 at 6:15 pm

    I figured out how to add the paths to the groups, but now I’m stuck on how to access the correct group.
    I can’t figure out where to put the name or index of the group I’m trying to access. The way the code is now the first group is the one being modified. Any help or direction would greatly be appreciated.

    var sVerts= [[-4.66796875,-4.614013671875],[-4.66796875,-1.584716796875],[4.701171875,-1.584716796875],[8.44921875,1.823486328125],[8.44921875,3.798095703125],[4.701171875,7.206298828125],[-4.66796875,7.206298828125],[-8.44921875,3.798095703125],[-8.44921875,3.387939453125],[-5.3125,2.809814453125],[-5.3125,4.512939453125],[5.283203125,4.512939453125],[5.283203125,1.208251953125],[-4.048828125,1.208251953125],[-7.833984375,-2.199462890625],[-7.833984375,-3.797607421875],[-4.048828125,-7.206298828125],[4.498046875,-7.206298828125],[8.283203125,-4.072998046875],[8.283203125,-3.729248046875],[5.248046875,-3.082275390625],[5.248046875,-4.614013671875]];
    var sITans= [[0,0],[0,0],[0,0],[0,-2.7265625],[0,0],[2.86328125,0],[0,0],[0,2.693359375],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,2.728515625],[0,0],[-2.83203125,0],[0,0],[0,-2.51806640625],[0,0],[0,0],[0,0]];
    var sOTans = [[0,0],[0,0],[2.86328125,0],[0,0],[0,2.693359375],[0,0],[-2.859375,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-2.83203125,0],[0,0],[0,-2.73095703125],[0,0],[2.658203125,0],[0,0],[0,0],[0,0],[0,0]];
    logoShapeLayer = activeItem.layers.addShape();
    logoShapeLayer.name="Logo";

    var sShape = new Shape();
    sShape.vertices = sVerts;
    sShape.inTangents = sITans;
    sShape.outTangents = sOTans;
    sShape.closed = true;

    var sShapeGroup = logoShapeLayer.property("Contents").addProperty("ADBE Vector Group").property("Contents").addProperty("ADBE Vector Shape - Group");
    //var sSapeGroupIndex = sShapeGroup.propertyIndex;
    sShapeGroup.name="S";
    sShapeGroup.property("ADBE Vector Shape").setValue(sShape);
    sShapeGroup = logoShapeLayer.property("Contents").property("ADBE Vector Group");
    sShapeGroup.name="S";
    sShapeGroup.property("ADBE Vector Transform Group").property("ADBE Vector Position").expression = "[178.6709,7.2063]";

    var cVerts= [[-4.7529296875,-4.545166015625],[-4.7529296875,4.444580078125],[4.7158203125,4.444580078125],[4.7158203125,1.382080078125],[8.2646484375,2.094970703125],[8.2646484375,3.798095703125],[4.4755859375,7.206298828125],[-4.5146484375,7.206298828125],[-8.2646484375,3.798095703125],[-8.2646484375,-3.797607421875],[-4.5146484375,-7.206298828125],[4.4755859375,-7.206298828125],[8.2646484375,-3.797607421875],[8.2646484375,-2.401611328125],[4.7158203125,-1.893798828125],[4.7158203125,-4.545166015625]];
    var cITans= [[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[2.8671875,0],[0,0],[0,2.66015625],[0,0],[-2.86328125,0],[0,0],[0,-2.73095703125],[0,0],[0,0],[0,0]];
    var cOTans = [[0,0],[0,0],[0,0],[0,0],[0,0],[0,2.693359375],[0,0],[-2.896484375,0],[0,0],[0,-2.693359375],[0,0],[2.8671875,0],[0,0],[0,0],[0,0],[0,0]];

    var cShape = new Shape();
    cShape.vertices = cVerts;
    cShape.inTangents = cITans;
    cShape.outTangents = cOTans;
    cShape.closed = true;

    var cShapeGroup = logoShapeLayer.property("Contents").addProperty("ADBE Vector Group").property("Contents").addProperty("ADBE Vector Shape - Group");
    //var cSapeGroupIndex = cShapeGroup.propertyIndex;
    cShapeGroup.name="C";
    cShapeGroup.property("ADBE Vector Shape").setValue(cShape);
    cShapeGroup = logoShapeLayer.property("Contents").property("ADBE Vector Group");
    cShapeGroup.name="C";
    cShapeGroup.property("ADBE Vector Transform Group").property("ADBE Vector Position").expression = "[158.6709,7.2063]";

    -bsides

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