Activity › Forums › Adobe After Effects Expressions › Font size no bigger than value
-
Font size no bigger than value
Posted by Constantin Dinu on January 27, 2025 at 2:58 pmhello people, im trying to find a way to alter this expression
text.sourceText.style.setFontSize(25) to something similar like
text.sourceText.style.setFontSize(<25)
i want to be able to modify the font size from the text panel the way i want it, but no bigger than 25.
any ideas?
thanks
Brie Claytonreplied 3 weeks ago 3 Members · 6 Replies -
6 Replies
-
Dan Ebberts
January 27, 2025 at 3:08 pmSomething like this should work:
curFontSize = style.fontSize;
style.setFontSize(Math.min(curFontSize,25)) -
Constantin Dinu
January 27, 2025 at 3:24 pmit works like a charm as a standalone. however, i have already an expression in the sourcetext, it’s a checkbox for getting text from another composition, or overriding by writing manual. if i insert your expression into this, doesnt seem to work. any ideas? my expression looks like this
a= thisComp.name.split(“_”)[0];
nume = thisLayer.name + (” “) + a;
manual = text.sourceText;
automat = comp(“data”).layer(nume).text.sourceText ;
if (effect(“manual”)(“Checkbox”) == 1) {
manual
}else{
automat
}
-
Constantin Dinu
January 27, 2025 at 3:27 pmits ok, ive managed to insert the expression in the after manual and automat, works perfectly. thank you so much for help
-
Dan Ebberts
January 27, 2025 at 3:31 pmHaven’t tested this, but something like this should work:
a= thisComp.name.split("_")[0];
nume = thisLayer.name + (" ") + a;
manual = text.sourceText;
automat = comp("data").layer(nume).text.sourceText ;
if (effect("manual")("Checkbox") == 1) {
txt = manual
}else{
txt = automat
}
curFontSize = style.fontSize;
style.setText(txt).setFontSize(Math.min(curFontSize,25))
Reply to this Discussion! Login or Sign Up