Creative Communities of the World Forums

The peer to peer support community for media production professionals.

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 pm

    hello 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 Clayton
    replied 3 weeks ago
    3 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    January 27, 2025 at 3:08 pm

    Something like this should work:

    curFontSize = style.fontSize;
    style.setFontSize(Math.min(curFontSize,25))
  • Constantin Dinu

    January 27, 2025 at 3:24 pm

    it 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 pm

    its 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 pm

    Haven’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))
  • Constantin Dinu

    January 27, 2025 at 3:38 pm

    youre a genius! works, thanks

  • Brie Clayton

    January 27, 2025 at 5:11 pm

    Thanks for solving this, Dan!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy