# Is it possible to make it so that a progress bar resets once it's full?

Basically, I’m trying to make it so that there’s one ba that tracks steps and is split into different segments, and another bar that tracks steps. When this second bar is full, one of the segments of the first bar will be full and the second one should start over, if that makes sense. Is this possible?

2 Likes

You will have to do it with two separate bars and filter when they show with opacity. One bar could be set to 10k steps and the other one set to 20k steps and would show half way full when 10k steps are reached.

4 Likes

Yes it is possible. Lets say you will have one bar that fills at 10k steps and another that resets each 1k.
The fill ratio for the later would be like
((#ZSC#%1000)/1000)

4 Likes

Not quite sure if this is what you mean, but in this watch face each box fills up. Each being 1000 steps:

Every box is 16x16, so the code for width of the first box is:
`(clamp(#ZSC#*0.016,0,16))`

second box:
`\$#ZSC#>1000?(clamp((#ZSC#-1000)*0.016,0,16)):0\$`

third box:
`\$#ZSC#>2000?(clamp((#ZSC#-2000)*0.016,0,16)):0\$`

etc…

4 Likes

You guys rock

2 Likes

Hi @nubbysinger and welcome!

I often have a progress bar for steps that changes scale depending on the amount - so it fills up for 0-999 then resets for 1000-50000/ I think you could take that logic to fill your bars depending on how many steps there are - if you inspect the following face and play with the step count you’ll see what I mean:

The code used is as follows:

``````\$#ZSC#<1000?(clamp(#ZSC#, 0, 1000)*0.001):(clamp(#ZSC#, 0, 10000)*0.0001)\$
``````

This is for a Progress Bar so the full value is 1 - you could apply this logic to a Width, say, and make the full value the width of the object you are using (Rectangle, Arc etc.)

The best way to learn is to experiment, so good luck trying things out!

3 Likes

Thank you …this is amazing

1 Like

Here’s the code for a bar that starts over and over again:

`(clamp(#ZSC#-floor(#ZSC#/10000)*10000,0,10000)/10000)`

So once 10’000 steps, then 20’000 steps, etc. are reached it always starts from 0 again.