2017-01-26 2 views
0

J'essaye d'écrire un script qui crée un rectangle, puis change sa couleur à partir de la valeur par défaut "Rouge", dans After Effects.Changement de couleur de la forme du script dans After Effects

Voici ce que j'ai. Il crée la forme, mais ne change jamais la couleur "Fill 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() 

Répondre

0

Compris. Il devrait être:

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