This content has been marked as final.
Show 5 replies

1. Re: Counting up in Multiples
Dan Ebberts Aug 15, 2016 10:41 PM (in response to Esodegrees)1 person found this helpfulI'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
Esodegrees Aug 16, 2016 2:22 AM (in response to Dan Ebberts)1 person found this helpfulYes! 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
laurentblanchard Mar 7, 2018 11:54 AM (in response to Dan Ebberts)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
Mathias Moehl Mar 7, 2018 1:04 PM (in response to laurentblanchard)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
laurentblanchard Mar 15, 2018 8:29 AM (in response to Esodegrees)Thanks a lot Mathias