Skip to main content
Known Participant
July 12, 2019
Answered

Modify Slider Range with Script?

  • July 12, 2019
  • 2 replies
  • 9663 views

Hi crazy people !

Can anyone tell me if it is possible to modify the range value of an Expression Control / Slider Control using script?

I'm getting change the value of the slider, but I can not find documentation on how to modify the "min value" and "max value" anywhere.

Does anyone have an example, if that's possible?

Regards

Rubens Nobre

This topic has been closed for replies.
Correct answer Tomas Sinkunas

You can use clamp function to clamp slider values. Apply this to Slider property and all the values will be trimmed they do not fall into the range.

var min = -10;

var max = 10;

value = clamp(value, min, max);

function clamp(value, min, max) {

    return Math.min(Math.max(value, min), max);

}

Cheers.

2 replies

Tomas Sinkunas
Tomas SinkunasCorrect answer
Legend
July 12, 2019

You can use clamp function to clamp slider values. Apply this to Slider property and all the values will be trimmed they do not fall into the range.

var min = -10;

var max = 10;

value = clamp(value, min, max);

function clamp(value, min, max) {

    return Math.min(Math.max(value, min), max);

}

Cheers.

Known Participant
July 12, 2019

You're a Genius! Thanks Tomas !

Alex White
Legend
July 12, 2019

Hi Ruben,

If you can't find it, then it's simply not there.

So yep, it's not possible to set those values via script.

Martin_Ritter
Legend
July 12, 2019

You can create a pseudo effect and use the script to apply this effect as workaround.

*Martin