Skip to main content
Participant
March 21, 2024
Answered

Is this Font Size Expression possible?

  • March 21, 2024
  • 1 reply
  • 826 views

I want to set up an expression where I can control the font size, but I want to limit how small/big that font size can go to using the slider. Is this possible?

 

For example.... If I want to limit the user to a range between 20 and 50 using the slider.

 

Appreciate any insight that could be provided!

This topic has been closed for replies.
Correct answer Dan Ebberts

Sorry.... still new to the coding aspect of expressions...

 

If I pickwhip the source text to the slide expression on a Null layer, I get this as a result - 

thisComp.layer("Slider").effect("Slider Control")("Slider")

 

I'm assuming that I have to do something like this to connect it all together - 

 

thisComp.layer("Slider");
sl = effect("Slider Control")("Slider");
style.setFontSize(clamp(sl,20,50))

 

Unfortunately, I'm getting an error and I'm unsure what is throwing it. Thank you again for this help. I want to learn this better and understand it better.


In that case, it would be like this:

sl = thisComp.layer("Slider").effect("Slider Control")("Slider");
style.setFontSize(clamp(sl,20,50))

1 reply

Mylenium
Legend
March 21, 2024

A simple linear(slider value, min, max) will do or alternatively a JS math clamp().

 

Mylenium 

Participant
March 21, 2024

So something like this would work?

 

clamp(value, min=20, max=20)