Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects How to use textSource.style expression with other expression

  • How to use textSource.style expression with other expression

    Posted by Hadi Kot on September 18, 2020 at 2:27 pm

    Simply how i can use this 2 expression all together

    thisComp.layer(“text A”).text.sourceText.style;

    effect(“Slider Control”)(“Slider”);

    right if i get the textSource from slider control value i can’t get the style from other layer

    so how i can do that? thanks

    Hadi Kot replied 5 years, 8 months ago 3 Members · 4 Replies
  • 4 Replies
  • Hadi Kot

    September 19, 2020 at 4:28 am

    Any help?

  • Jean Baptiste

    September 19, 2020 at 10:34 am

    Hello Hadi,

    You can try to use this expression in a Text Layer “Source Text” field.

    FONT_SIZE = effect(“FONT_SIZE”)(“Slider”);
    text.sourceText.style.setFontSize(FONT_SIZE);

    Attention, you must : Go to File > Project Setting > Expressions, and set the Expression Engine to JavaScript. Otherwise, “text style” expressions won’t work.

    Project sample here
    https://www.dropbox.com/s/4qxgmmd66xtam7p/

    More information on Text Style Expressions here :
    https://helpx.adobe.com/after-effects/using/expressions-text-properties.html

  • Filip Vandueren

    September 19, 2020 at 11:08 am

    Hello Hadi,

    it’s a perhaps bit counterintuitive, but you get the style, and then you apply a setText() method to the style. You can’t take a text (which would be converted a string) and add a style to it.

    so in your case:

    s = thisComp.layer("text A").text.sourceText.style;
    s.setText( effect("Slider Control")("Slider").value );
  • Hadi Kot

    September 19, 2020 at 1:54 pm

    Perfect, that exactly what I want Thumbsup

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