Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Checkbox fixed text leading

Tagged: 

  • Checkbox fixed text leading

    Posted by Gerben Greuliker on December 2, 2025 at 3:47 pm

    Hi There,

    I’m trying to add a checkbox control to a simple expression I made to control the leading and scaling of a text. The number value needs to be 77.7 or 90 (value at the end of the expression, (“Slider”)/100*77.7)) so the leading can only be either 77.7 or 90. Is this an easy fix for the for the gods of the AE Expression pantheon? 😊

    text.sourceText.style
    .setFontSize(thisComp.layer("Expression_Ctrls").effect("SLIDER-3_REGELS")("Slider"))
    .setLeading(thisComp.layer("Expression_Ctrls").effect("SLIDER-3_REGELS")("Slider")/100*77.7)
    .setAllCaps(true);
    Brie Clayton
    replied 5 months ago
    3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    December 2, 2025 at 5:31 pm

    I think that will look something like this:

    cb = thisComp.layer("Expression_Ctrls").effect("Checkbox Control")("Checkbox").value;
    leading = cb ? 90 : 77.7;
    text.sourceText.style
    .setFontSize(thisComp.layer("Expression_Ctrls").effect("SLIDER-3_REGELS")("Slider"))
    .setAutoLeading(false)
    .setLeading(thisComp.layer("Expression_Ctrls").effect("SLIDER-3_REGELS")("Slider")/100*leading)
    .setAllCaps(true);


  • Gerben Greuliker

    December 4, 2025 at 10:15 am

    Dan, again many thanks for a perfect working expression!

    If I may borrow some more of your time, i’m trying to get a grasp of writing my own expressions and manage to write simple ones. Can you elaborate on the functions you are using on line 2?

    cb gives a value of 0 or 1 depending on the state of the checkbox but what happens after that? Is it some short version of an if/else statement?

    leading = cb ? 90 : 77.7;
  • Dan Ebberts

    December 4, 2025 at 7:54 pm
    That's exactly what it is. It's the JavaScript ternary (or conditional) operator. So if cb is true (1 in this case) the result is 90, otherwise it's 77.7.
  • Brie Clayton

    December 13, 2025 at 11:58 pm

    Thank you for solving another one, Dan!

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