-
Is it possible to combine two properties from textSource into new text layer?
Hi smart people of Creative Cow…
I have been playing around with the new font style expressions now available in Ae cc2020. Now it might be my terminology which is letting me down or my super tired dad brain but I am finding it hard to find clear information on how to combine two properties from a single textSource property from a user text layer into a textSource on another text layer.
What I would like to achieve is to get the width of a single specific character from a string entered by the user on a text layer, I also need to parse the style of the font using the new style or getStyleAt() expression, so the single specific character dynamically changes with any change made to the user input text and an change made to the font style itself. This is so that I can eventually apply an effect to that specific character which is based on the width of that character.
Example:
I want to isolate the “X” from the word “TEXT” and apply an effect based on the width of the “X” to that character.
I can do this using:
a = thisComp.layer(“User Text”).text.sourceText.charAt(2);
Which gives me just the “X” and a bounding rectangle the size of the “X”.
I also want to parse the style of the font in the user text layer by using:
b = thisComp.layer(“User Text”).text.sourceText.getStyleAt(0);
On it’s own this expression will parse the font style okay. However I need to combine the two expressions (a and b). Sadly every combination I try either results in an error or no error but no text is not displayed, just a blank text layer.
How would I combine these two, if possible?
a = thisComp.layer(“User Text”).text.sourceText.charAt(2);
b = thisComp.layer(“User Text”).text.sourceText.getStyleAt(0);Normally this isn’t an issue, with for example, numbers as it is just a case of math, but with textSource I’m a little bit lost….
Many thanks!
P.
a = thisComp.layer("User Text").text.sourceText.charAt(2);
b = thisComp.layer("User Text").text.sourceText.getStyleAt(0);//a.b?
//a + b?