Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Alternating text styles in a sourceText property

  • Alternating text styles in a sourceText property

    Posted by Simon Heimbuchner on December 10, 2021 at 1:43 pm

    Hey people,

    I was wondering if any of you knew whether it’s possible to have alternating text styles in the new AE sourceText expressions. Seems kinda impossible from what I can gather from the syntax, but do you guys know anything about that?

    Here’s some sample code to explain what I’m trying to do.

    // get sourceText styles from two layers
    const headlineStyle = thisComp.layer("Headline Style").text.sourceText.getStyleAt(0,0);
    const sublineStyle = thisComp.layer("Subline Style").text.sourceText.getStyleAt(0,0);

    // get sourceText value from another layer
    let v = thisComp.layer("Sample Text").text.sourceText;
    // split by newline
    v = v.split("\n");

    // assign different text styles to resulting array

    // here comes some wishful thinking syntax, I know that's not how any of this works
    v[0].applyStyle(LHeadlineStyle)
    v[1].applyStyle(LSublineStyle)

    Thanks in advance, love this forum!

    Simon Heimbuchner replied 4 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    December 10, 2021 at 1:49 pm

    Unfortunately, once you apply an expression to sourceText, all characters get the same style as the first character. So I don’t think there’s a way to do what you want with a single text layer.

  • Simon Heimbuchner

    December 10, 2021 at 1:51 pm

    Seemed too good to be true. Thanks, Dan!

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