After Effects中的脚本形状颜色更改

时间:2017-01-26 21:30:53

标签: javascript after-effects

我正在尝试编写一个创建矩形的脚本,然后在After Effects中更改默认" Red"的颜色。

这就是我所拥有的。它创造了形状,但从不改变"填充1"颜色。

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 ()

1 个答案:

答案 0 :(得分:0)

想出来。它应该是:

shapeLayer.content("Group 1").content("Fill 1").color.setValue(myRGBColor);