ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Counting specific layers from above the current layer?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Kyung Ko
Counting specific layers from above the current layer?
on Feb 4, 2020 at 11:44:55 pm

Hello,

I have many text layers mixed with the other type of layers, and the main text layer, L1 is in the middle.
So basically I would like to count the number of text layers that include "title" in the text field only from the layers above the L1 layer and print it out to L1 layer.

Thanks for your help! :)


Return to posts index

Dan Ebberts
Re: Counting specific layers from above the current layer?
on Feb 5, 2020 at 12:30:05 am

Something like this should work:


count = 0;
for (i = 1; i < index; i++){
L = thisComp.layer(i);
try{
if (L.text.sourceText.value.indexOf("title") > -1) count++;
}catch(e){
}
}
count



Dan



Return to posts index

Kyung Ko
Re: Counting specific layers from above the current layer?
on Feb 5, 2020 at 3:08:15 pm

Thanks so much Dan!! This solved the problem I tried to get for hours.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]