ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Scott McGee
create comp, create shape, import file and add track matte.
on Aug 7, 2018 at 8:31:28 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 = shapeLayer.property("Contents").addProperty("ADBE Vector Group");
shapeGroup.property("Contents").addProperty("ADBE Vector Shape - Ellipse");
shapeGroup.property("Contents").addProperty("ADBE Vector Graphic - Stroke");
shapeGroup.property("Contents").addProperty("ADBE Vector Graphic - Fill");

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

myComp.layers.add(imp);

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?


Return to posts index

Scott McGee
Re: create comp, create shape, import file and add track matte.
on Aug 7, 2018 at 9:04:26 am

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

myComp.layers[2].moveBefore(myComp.layer(1));


Return to posts index

Andreas Brand
Re: create comp, create shape, import file and add track matte.
on Aug 7, 2018 at 11:54:06 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.
Andreas


Return to posts index


Scott McGee
Re: create comp, create shape, import file and add track matte.
on Aug 7, 2018 at 1:12:35 pm

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

myComp.layers.add(imp);

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

layer1
layer2(previously layer1)

Thank you


Return to posts index

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