Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to combine 2 expressions under Source Text

  • How to combine 2 expressions under Source Text

    Posted by Frederic Beaulieu on February 18, 2021 at 1:03 am

    Hi,

    I would like to create an expression that when applied to Source Text, allow me to repeat a word horizontaly and verticaly and also uses slider expressions to animate the font size, leading and tracking.

    So this is the styling part:

    txt = text.sourceText;
    var z = effect("Size")("Slider");
    var l = effect("Leading")("Slider");
    var t = effect("Tracking")("Slider");
    createStyle().setFontSize(z).setAutoLeading(false).setLeading(l).setTracking(t).setText(txt);

    And this is the repeating part:

    xRepeater = effect("xRepeat")("Slider").value;
    yRepeater = effect("yRepeat")("Slider").value;
    horzRepeat = txt.repeat(xRepeater);
    vertRepeat = horzRepeat + "\n";
    vertRepeat.repeat(yRepeater);

    Both work independently, i’m just scratching my head about how to combine them.

    Dan Ebberts
    replied 1 week, 6 days ago
    3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    February 18, 2021 at 7:20 am

    Something like this should work:

    txt = text.sourceText;

    var z = effect("Size")("Slider");

    var l = effect("Leading")("Slider");

    var t = effect("Tracking")("Slider");

    xRepeater = effect("xRepeat")("Slider");

    yRepeater = effect("yRepeat")("Slider");

    horzRepeat = txt.repeat(xRepeater);

    vertRepeat = horzRepeat + "\n";

    repeatTxt = vertRepeat.repeat(yRepeater);

    createStyle().setFontSize(z).setAutoLeading(false).setLeading(l).setTracking(t).setText(repeatTxt);

  • Frederic Beaulieu

    February 18, 2021 at 2:36 pm

    Wonderful! Thanks for your precious help! Merci beaucoup!

  • Mårten Gunge

    February 4, 2025 at 10:46 am

    Hi. I have a somewhat similar problem. I am trying to make a “money counter”. A slider goes from 30 to 1500. The problem is that the client has really rigid typo-rules. Needs to be a very specific space between 1 and 000 when the slider hits 1000. I´ve made this little snippet. Problem is that the styling seems to disable the input from the slider, so there is no animation, only static sourcetext.

    text=effect("Slider Control")("Slider")+" dollarez”;
    if (effect("Slider Control")("Slider") > 999) {
    style.setTracking(180, 0, 1)
    }
    else
    {style.setTracking(0);};

    Tried to fix it with sourceRectAtTime, but no luck. Guess that´s part of the problem; need knowledge, not luck. Please enlighten me!

  • Dan Ebberts

    February 4, 2025 at 5:02 pm

    This should work:

    txt = effect("Slider Control")("Slider") + " dollarez";
    if (effect("Slider Control")("Slider") > 999) {
    style.setText(txt).setTracking(180, 0, 1)
    }else{
    style.setText(txt).setTracking(0);
    }

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