Forums › Adobe After Effects Expressions › Add the Animate Fill Color RGB to text layer
-
Add the Animate Fill Color RGB to text layer
-
Jace Bradley
January 14, 2023 at 7:33 pmI am trying to create a script that add the Fill Color RGB to selected text layers.
here is the code so far
// Create a new window for the UI panel
var myPanel = new Window(“palette”, “Add RGB Fill”, undefined);
// Add a button to the panel
var myButton = myPanel.add(“button”, undefined, “Add RGB Fill Color”);
// Add an event listener to the button
myButton.onClick = function() {
// Get the active composition
var activeComp = app.project.activeItem;
if (!(activeComp instanceof CompItem)) {
alert(“Please select a text layer in the active composition.”);
return;
}
// Get the selected text layers
var selectedLayers = activeComp.selectedLayers;
if (selectedLayers.length == 0) {
alert(“Please select at least one text layer.”);
return;
}
for (var i = 0; i < selectedLayers.length; i++) {
var textLayer = selectedLayers[i];
if (!(textLayer instanceof TextLayer)) {
alert(“Please select only text layers.”);
return;
}
// get the text path
var PickColor = textLayer.property(“Text”);
//after getting this path, how can I add the animate Fill Color RGB?
}
// Show the UI panel
myPanel.show();
Any help?
-
Manuel Moellmann
January 14, 2023 at 7:42 pmtook me about 20 seconds to find a solution on google. “after effects script add fill color animator”
-
Dan Ebberts
January 14, 2023 at 7:45 pmI think this works:
// Create a new window for the UI panel
var myPanel = new Window("palette", "Add RGB Fill", undefined);
// Add a button to the panel
var myButton = myPanel.add("button", undefined, "Add RGB Fill Color");
// Add an event listener to the button
myButton.onClick = function() {
// Get the active composition
var activeComp = app.project.activeItem;
if (!(activeComp instanceof CompItem)) {
alert("Please select a text layer in the active composition.");
return;
}
// Get the selected text layers
var selectedLayers = activeComp.selectedLayers;
if (selectedLayers.length == 0) {
alert("Please select at least one text layer.");
return;
}
for (var i = 0; i < selectedLayers.length; i++) {
var textLayer = selectedLayers[i];
if (!(textLayer instanceof TextLayer)) {
alert("Please select only text layers.");
return;
}
var animator = textLayer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator");
var fill = animator.property("ADBE Text Animator Properties").addProperty("ADBE Text Fill Color");
}
}
// Show the UI panel
myPanel.show(); -
Jace Bradley
January 14, 2023 at 8:48 pm -
Dan Ebberts
January 14, 2023 at 9:28 pmGood point. Change that section to this:
var animator = textLayer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator");
var selector = animator.property("ADBE Text Selectors").addProperty("ADBE Text Selector");
var fill = animator.property("ADBE Text Animator Properties").addProperty("ADBE Text Fill Color");
Log in to reply.