FACER Community

Battery progress bar

Hello

I would like to use 4 bars and I can’t do it.

bar 1 = 76 - 100% battery
bar 2 = 51 - 75% battery
bar 3 = 26 - 50% battery
bar 1 = 0 - 25% battery

does anyone have any good advice?

1 Like

Hi @SR-Design.vision
Do you want 4 bar as an image? If so you need to apply formula separately for each images.
One more thing from my end i would like to highlighted here as below if battery percentage divided by 4.
When actual battery level comes at 26% the images will show battery level 50%. And there is a gap 24% at least between actual battery level and the defined bar. Hope got the point.

1 Like

For example you can use folowing formula for opacity of each bar:
bar 1 = 76 - 100% battery $#BLN#>75?100:0$
bar 2 = 51 - 75% battery $#BLN#<76&&#BLN#>50??100:0$
bar 3 = 26 - 50% battery $#BLN#<51&&#BLN#>25??100:0$
bar 4 = 0 - 25% battery $#BLN#<26?100:0$

Or you can try just one bar with following fill ratio formula:
(0.25*(ceil(#BLN#/25)))

5 Likes

thank you for your help …

I want to use 4 facer progress bars on top of each other.
these should empty one after the other.

so no pics…


1 Like

I think the bars should be little different then. Like:
For example you can use folowing formula for opacity of each bar:
bar 1 = 75 - 100% battery $#BLN#>75?100:0$
bar 2 = 50 - 100% battery $#BLN#>50?100:0$
bar 3 = 25 - 100% battery $#BLN#>25?100:0$
bar 4 = 0 - 100% battery 100

2 Likes

these are good codes for visibility.
I have already tested these.

I just don’t find the possibility to program the progress bar in such a way that it only empties the range between 75 - 100%, for example.

Visibility is not the issue here.

in my test this only works at 0 - 25%

1 Like

Sorry, I am still not sure what are your intentions with the bars :slight_smile:
Do you want them to change fill, or show up, or both?

2 Likes

Normally, a battery progress bar would show a range between 0 - 100% over the entire length.

i want the bar to show a range between 75 - 100% or 50 - 75% or 25 - 50% or 0-25%.

as in my test the bottom of the 4 bars.

this currently shows 0 - 25% real.
Unfortunately I can’t do that with the other 3.

1 Like

@SR-Design.vision My understanding is you want the 4 bars to empty concecutivly in a smoot manner. I have done someting like this befor with an auto ranging Step counter. I am not at my Laptop. At the moment. A good trick is to simulate the action with The Time Machine Slider using #DWFHS# as a stand in for your #BLN# slightly different end number but it helps to Iron out the maths. If you have not crackled it later I will help again. Busy at the moment. No Laptop Allowed.

I know it is something to do with. Minus 25 50 and 75 and *4.

1 Like

I think I understand now. Try this for fill ratio:
bar 1 = 76 - 100% battery (clamp((#BLN#-75)/25, 0, 1))
bar 2 = 51 - 75% battery (clamp((#BLN#-50)/25, 0, 1))
bar 3 = 26 - 50% battery (clamp((#BLN#-25)/25, 0, 1))
bar 4 = 0 - 25% battery (clamp(#BLN#/25, 0, 1))

6 Likes

ah perfect

I thought about it all night and couldn’t find a solution.

Thanks for your help.
That’s great

The preview above should now work.

3 Likes

And some people @petruuccios know how to use clamp .
NiceTutorial.
Topic Bookmarked.

3 Likes