Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions One expression 2 sliders

  • One expression 2 sliders

  • Vincenzo Marchese Ragona

    June 1, 2021 at 2:12 pm

    Hi!

    I’m currently working on an animation where i have to play with a text leading and size.

    I’ver set the expressions


    newStyle = style.setFontSize(effect(“Size”)(“Slider”));

    newStyle = style.setLeading(effect(“Leading”)(“Slider”));

    But when I connect them to the slider only one of the two works. Almost like it goes in conflict. Is there maybe a way to calculate and retain the leading/size ratio and attaching it to one slider only so it feels consistent all the way?

    Here’s attached an image for reference https://imgur.com/a/aWAPYPm

    Thanks!!

  • Filip Vandueren

    June 1, 2021 at 3:19 pm

    Combine both values into the same style by chaining the methods:

    newStyle = style.setFontSize(effect(“Size”)(“Slider”)).setLeading(effect(“Leading”)(“Slider”));
  • Vincenzo Marchese Ragona

    June 1, 2021 at 3:43 pm

    Hey thanks for your answer, I’m presenting me this error now.

  • Filip Vandueren

    June 1, 2021 at 3:46 pm

    The website converted straight “quotes” to curly “quotes”.

    JavaScript needs straight single or double quotes.

  • Vincenzo Marchese Ragona

    June 1, 2021 at 3:54 pm

    that worked! Thank you so much!

  • Wyatt Kedinger

    June 1, 2021 at 7:11 pm

    You could also try this, which I did for a specific branded treatment that needed to retain the same font size to leading ratio at scale. This allows you to scale up the font size with the slider and the leading will follow.

    You’ll need to do the math to come up with the ratio of size to leading and replace the ‘x’ with your number. Then, create a slider and then put your slider name in place of “Font Size”.

    Wyatt

    // Font size multiplied by x (x = the ratio of font size to leading)

    style.setFontSize(effect("Font Size")("Slider")).setAutoLeading(false).setLeading(effect("Font Size")("Slider")*x).setFont("Axiforma-Black");

  • Vincenzo Marchese Ragona

    June 2, 2021 at 8:29 am

    Sounds awesome Wyatt! Will try now! Thank you!

Viewing 1 - 7 of 7 posts

Log in to reply.

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