5 Replies Latest reply on Mar 15, 2018 8:29 AM by laurentblanchard

Counting up in Multiples

How do i set an expression to my slider to count in Multiples of 10s, 20s.... to my very last key@@frame?

Thanks

• 1. Re: Counting up in Multiples

I'm not sure if this is what you mean, but try:

Math.round(value/20)*20

or:

Math.floor(value/20)*20

Dan

• 2. Re: Counting up in Multiples

Yes! thanks Sir...nver thought of that

ended up with this..

x = effect("Slider Control")("Slider")

Math.round(x/20)*20

• 3. Re: Counting up in Multiples

Hello,

I follow up on the thread to ask how I could manage to keep the counting by 20 but at the end for the last 20 step I want to count by 1.

So let's say I have a slider from 0 to 2208 so it counts by 20 until 2200 then 2201, 2202, 2203,...,2208.

I imagine something like :

Math.round(value/20)*20

if (value>2200) { Math.floor(value/1)*1;

As you can see I am really not into writing code :-(

Thank you for any help.

Patrick.

• 4. Re: Counting up in Multiples
if (value>2200)  Math.floor(value/1)*1
else Math.floor(value/20)*20

or simplified

if (value>2200)  Math.floor(value)
else Math.floor(value/20)*20

• 5. Re: Counting up in Multiples

Thanks a lot Mathias