Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions create comp, create shape, import file and add track matte.

  • create comp, create shape, import file and add track matte.

  • Scott McGee

    August 7, 2018 at 8:31 am

    Everything works fine except one little issue. I want the shape to be created first. then add the file and add a track matte.

    var myComp = proj.items.addComp(“Logo”, 500, 600, 1, 10, 25);

    var shapeLayer = myComp.layers.addShape();
    var shapeGroup =“Contents”).addProperty(“ADBE Vector Group”);“Contents”).addProperty(“ADBE Vector Shape – Ellipse”);“Contents”).addProperty(“ADBE Vector Graphic – Stroke”);“Contents”).addProperty(“ADBE Vector Graphic – Fill”);

    var io = new ImportOptions(File(“filepath”));
    var proj = app.project;
    var imp = proj.importFile(io);


    myComp.layers[2].trackMatteType = TrackMatteType.ALPHA_INVERTED;

    Even though I’ve put it in order. Top to bottom, which I always thought was the logic of this. I don’t understand why it’s adding the image first, then creates the shape layer.

    Any thoughts?

  • Scott McGee

    August 7, 2018 at 9:04 am

    Not the way I want to do it, but if anyone has a better idea. This is how I’ve gotten around it.


  • Andreas Brand

    August 7, 2018 at 11:54 am

    Hello Scott

    If you add a layer to a comp with script it always add it on top of the other layers.

    In this case you add the shape layer and it is index 1. Then you add the image and it will be added on top of the other layer.

    The easiest solution is to first add the image and then the shape layer.

    Hope that helps.

  • Scott McGee

    August 7, 2018 at 1:12 pm

    I am an idiot. I thought I had done it the way you had suggested and realised my


    was sat under the shape layer. So no matter how many times I was moving the other half up and under the add shape. It was never going to fix it.

    Plus it didn’t help in my head that it adds it too the top, which makes absolute sense.

    layer 1

    layer2(previously layer1)

    Thank you

Viewing 1 - 4 of 4 posts

Log in to reply.

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