-
Expression Selector: character before/after?
No matter how many Google searches and YouTube videos, I just can’t make this work. I got it close but it seems to have a life of its own that messes with my troubleshooting.
Short version, I want it to look through a text layer, find the letter “A,” then check the letter before that and, if it matches a letter from a predefined array, adjust the tracking before. A second Animator would do the same for the letter after the “A.” Basically the font has some wonky kerning on the “A”s in certain character combinations and I’m trying to auto-fix it for a mogrt.
So I set up a Tracking Animator, added an Expression selector and (after lots of Google hunting) cobbled together this:
a=text.sourceText;
if (a[textIndex-1] == "a") {
b=a.charAt(textIndex-2); //check letter before the A
if (b=="a" || b=="e" || b=="k" || b=="l" || b=="q" || b=="x" || b=="z")100 else 0
}
else 0 //this doesn't seem necessary but it failed without itMost of which probably isn’t right, but it seems to be almost working (I swear, once it actually did work). It’s just apparently not checking the previous character and just applying it to every “A” regardless. I originally tried setting up the comparison with a nested For loop and an Array, but that threw everything into chaos.
I’m guessing it has to do with not really understanding how textIndex functions. Am I close? Way off? This even possible?