Reputation: 1342
I am trying to write a script that creates a rectangle, and then changes its color from the default "Red", in After Effects.
Here's what I have. It creates the shape, but never changes the "Fill 1" color.
function createBackgroundShape() {
var currentComp = app.project.activeItem;
if (currentComp) {
var shapeLayer = currentComp.layers.addShape();
var shapeGroup = shapeLayer.property("Contents").addProperty("ADBE Vector Group");
shapeGroup.property("Contents").addProperty("ADBE Vector Shape - Rect");
shapeGroup.property("Contents").addProperty("ADBE Vector Graphic - Stroke");
shapeGroup.property("Contents").addProperty("ADBE Vector Graphic - Fill");
var myRGBColor = [0, 255, 0, 255]/255;
shapeLayer.content("Group 1").content("Fill 1").color = myRGBColor;
shapeLayer.content("Group 1").content("Stroke 1").color = myRGBColor;
}
}
createBackgroundShape ()
Upvotes: 1
Views: 2794
Reputation: 1342
Figured it out. It should be:
shapeLayer.content("Group 1").content("Fill 1").color.setValue(myRGBColor);
Upvotes: 1