Forums › Adobe After Effects Expressions › Text styling expression: 2 styles in one layer
Text styling expression: 2 styles in one layer
Yoan Boisjoli
March 1, 2021 at 1:44 amHey folks!
I’m currently creating a mogrt and I created a date text layer thats driven by a drop down menu for the months and a slider for the days. So far so good but I need to have access to superscript (which is not available in the text styling expressions yet) for whenever the date needs a “st” for 21st or a “nd” for 22nd. You get the idea.
I’m wondering if it’s possible to only have the “st” or “nd” be a smaller font size.
Whenever I try the style and setFontSize() it shows as September 21[object, object].
Any clues? 🤓
Tomas Bumbulevičius
March 1, 2021 at 9:31 amHey Yoan – the questions is how do you plan to isolate suffixes and how they will be “decided” to use? Will it be done with expressions, by affecting last two chars of a number (st,nd,rd,th)? That will indicate an approach how to make this happen – either with styles, or with text animator & scale.
Yoan Boisjoli
March 1, 2021 at 12:10 pmHey Thomas! Thanks for reply!
I was too much into wanting to use the text styling expressions that I forgot that I could just use an expression selector with some Regex!
I’ll just have the scale and position be triggered and it will do the trick!
Thanks! Have a good day!
Andrei Popa
March 1, 2021 at 4:33 pmHi Tomas. As far as you know, is it possible to modify just a part of a paragraph via expressions using style?
Kevin Camp
March 1, 2021 at 5:10 pmIt would be great if you could.
I had hoped that styles would work that way, but when I’ve tried to achieve something similar, I found the same issue that Yoan ran into, and then reverted to a method using text animators or separate layers and sourceRectAtTime().
Fabrice Leconte
March 2, 2021 at 1:11 pmTry to find a good font, it works with Arial
function getOrdinalNum(n) {
return n + (n > 0 ? ['ᵗʰ', 'ˢᵗ', 'ⁿᵈ', 'ʳᵈ'][(n > 3 && n < 21) || n % 10 > 3 ? 0 : n % 10] : '');
}
d = getOrdinalNum(effect('Slider Control')('Slider'));
m = Intl.DateTimeFormat('en', { month: 'long' }).format(effect('Dropdown Menu Control')('Menu'));
'Roboto font: '+ m + ' '+ d
Yoan Boisjoli
March 2, 2021 at 1:16 pmWow that’s pretty clever Fabrice! Merci!
Log in to reply.