-
Text from array layer to text layer depending on text in a third text layer
Another day of diving deeper into After Effects expressions and another hurdle in front of me:
So I have 3 text layers:
A = text layer consisting of many (double) names & (double) surnames, some with a number if the names are the same, each name is separated by a comma (copied over from an excel sheet).
B = text layer that is used as an input for names.
C = text layer that is showing matching names and changes characters that match to bold while the input in B is given.
<div>I kind of know, what to do to get what I want, but I don’t know how to express it in After Effects (or how to combine those expressions that I do know. Basically what I want and what I came up with:</div><div>
Layer A: nothing, just have those names.
</div>
Layer B: nothing, just display text that is entered.
Layer C: Make an array out of those names in layer A, each value is seperated by a comma, replace those commas with line breaks:
array = [A.text.sourceText.replace((","),("\r"))];Which does a line break after every name,
but I’m pretty sure that it’s not making an array out of it.Check every line if it matches with the input in layer B:
if (B.charAt(0) == A.text.sourceText.charAt(0)) {A.text.sourceText.charAt(0)}Input is “Carl” to make things easier:
The Expression results in a single C because the first name in the list is Carl, but neither does it show multiple C’s nor does it work with other letters (and even if that would work, I would have to do that for every character seperately to get it to show “Carl” and then all the other names individually as well, wouldn’t I?).
I know that I’m not using the array (that might not be one in the first place anyway) because I don’t get it combined with “charAt”.
Finally make those characters that match bold.
style.setFauxBold(true)
So how do I combine all these and shorten the expression so that I don’t have to manually do the check line for each first letter, second letter, third letter, etc.?
Thanks!