Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions How do I add an Rectangle shape to a Comp with script?

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

  • taehyung kim

    October 25, 2011 at 11:09 am

    Here the ellipse has found a way to add to the script. But I do not know how to add a Rectangle. Can you fix this script?

    var myComp = this.InterlaceComp;

    var myEllipseSize = [footage.width*2,footage.width*2];
    var myFillColor = [0, 0, 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);

    this.InterlaceComp.layer(1).name = "Interlace_Matte";

  • Dan Ebberts

    October 25, 2011 at 3:21 pm

    I can’t test it right now, but I think all you need to do is change “Ellipse” to “Rectangle”.

    Dan

  • taehyung kim

    October 26, 2011 at 12:21 am

    Replace the last “rectangle” and “ellipse”. But failed. I think value is wrong

    But thank you. Dan

  • Dan Ebberts

    October 26, 2011 at 12:35 am

    You’re right. It should be:

    “ADBE Vector Shape – Rect”

    It try it, but it looks like you only posted part of the script.

    Dan

  • taehyung kim

    October 26, 2011 at 1:16 am

    oh~! awesome~!!

    But still there is an error in this part.

    var myRectangleSize = [0,0,footage.width,footage.height];
    myRectangle.property(“ADBE Vector Rectangle Size”).setValue(myRectangleSize);

    The second line of the error
    (I had to fix ‘Rectangle Size’ = ‘Rect Size’. but error.)

    How do I replace?

    In another line of no more Debuging error.

Viewing 1 - 5 of 5 posts

Log in to reply.

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