• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to limit slider range from 0 to 100, with integers only?

Explorer ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

Greetings,

 

How can I limit a slider input and output range from range from 0 to 100, and have the slider round off to integers only when sliding the slider? Thanks for any help on this 🙂

TOPICS
Expressions , How to , Scripting

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Aug 01, 2022 Aug 01, 2022

Try this - 

const myValue = thisProperty;
Math.round(clamp(myValue,0,100))



Votes

Translate

Translate
Valorous Hero ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

Try this - 

const myValue = thisProperty;
Math.round(clamp(myValue,0,100))



Motion Graphics Brand Guidelines & Motion Graphics Responsive Design Toolkits

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

Ah, perfect this worked as needed, thank you Roland!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

In case you keyframe the slider: Just note that Roland's expression does not only round keyframes values, but also all the interpolation between them (this may or may not be what you want).

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

LATEST

Hi Mathias, thanks for the additional info, something for me to be aware of.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines