Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Source Text Expressions

  • Source Text Expressions

  • chris taylor

    October 12, 2021 at 5:09 pm

    Hi all,

    I am trying to combine several text-specific expressions, but I can only get 1 to work.

    Depending on the layout, the 2nd one will always override the first.

    I have tried the if/else expression and the substring, but none seem to work together.

    The first expression is a character limit.

    The second is a “source text style”, driven by sliders and checkboxes.

    I don’t know if I am missing something or if there is an issue with them working together.

    Any guidance on this would be very helpful.

    l = text.sourceText.length;

    if (l>25) {

    “MAX LENGTH EXCEEDED”

    } else {

    text.sourceText;

    }

    var array=[

    “Worker-ExtraBold”,

    “Worker-Regular”,

    ]

    text.sourceText.style

    .setFontSize(thisComp.layer(“CTRL”).effect(“Font Size”)(“Slider”))

    .setFont(array[thisComp.layer(“CTRL”).effect(“Font Select”)(“Slider”)])

  • Dan Ebberts

    October 12, 2021 at 5:23 pm

    I haven’t tested this, but I think you just need to save your text in a variable and then use .setText() at the end of your expression, like this:

    l = text.sourceText.length;

    if (l>25) {

    txt = "MAX LENGTH EXCEEDED"

    } else {

    txt = text.sourceText;

    }

    var array=[

    "Worker-ExtraBold",

    "Worker-Regular",

    ]

    text.sourceText.style

    .setFontSize(thisComp.layer("CTRL").effect("Font Size")("Slider"))

    .setFont(array[thisComp.layer("CTRL").effect("Font Select")("Slider")])

    .setText(txt)

  • chris taylor

    October 13, 2021 at 7:59 am

    Yep that worked perfectly

Viewing 1 - 3 of 3 posts

Log in to reply.

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