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

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

Explorer ,
Aug 01, 2022 Aug 01, 2022

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
1.9K
Translate
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))



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

Try this - 

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



Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV
Translate
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

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

Translate
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

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
Translate
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
LATEST

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

Translate
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