-
After Effects Expression – Pro Trick – Multiple Layer Names on 1 Text Layer
You’ll occasionally have to overlay a layer’s name in your After Effects comp. If you didn’t know better, you’d have 1 Text Layer for each Layer.
BUTT there’s a better way …
Apply this to the Source Text Property of a Text Layer –
// Start of Expression
let layerNames = “”;
for (let i = 1; i <= thisComp.numLayers; i++) {
if (i === index) continue;
let targetLayer = thisComp.layer(i);
if (http://targetLayer.active) {
layerNames +=
Layer Index:${targetLayer.index} - ${http://targetLayer.name}\r\n
;}
}
layerNames.trim();
// End of Expression
If you don’t have overlapping layers, then use the version of the Expression displayed at the end of this video –
https://youtu.be/JXmoVWsuwUA