Hi!
This is how I'd do it. Note that this doesn't do any error checking (it doesn't check that a comp exists, or that there are any layers, or that there aren't keyframes) -- but for a really simple first pass, this should work!
Code: Select all
(function () {
// Get the active composition
var comp = app.project.activeItem;
// Get layers in the comp
var layers = comp.layers;
// Create an "Undo Group", so every action between this and app.endUndoGroup()
// can be undone in a single stage
app.beginUndoGroup("Set TextLayer Opacity to 0");
// Loop through all of the layers
for (var i = 1, il = layers.length; i <= il; i++) {
var layer = layers[i];
// If the current layer isn't a text layer, skip it
if (!(layer instanceof TextLayer))
continue;
// Set the layer's opacity to 0
layer.opacity.setValue(0);
}
app.endUndoGroup();
})();
Let me know if this helps, or if you have any questions!