I'm looking for an unusual code again

I’m looking for an unusual code again.
I want to create 16 fields.
These 16 fields are intended to show the batt status in stages.
That would actually be relatively easy.

now comes the hard part…
I don’t just want to turn it on and off, I want to dim it.
So link visibility to battery level.

who has a suitable idea for this?

For example, my watch face TX-CR112 does this with 5 circles, opacity settings:

1st: $#BLN#>=2?(#BLN#*5):0$
2nd:$#BLN#>=20?(#BLN#*2.5):0$
3rd:$#BLN#>=40?(#BLN#*1.66):0$
4th:$#BLN#>=60?(#BLN#*1.25):0$
5th:$#BLN#>=80?#BLN#:0$

I can’t see it clearly.
the dimming itself is not directly linked to the batt state, well?

Thank you for your help

It is linked to the battery level.

At 100% all circles are at 100 opacity.
The battery level goes down, the the 5th circle gets dimmer, once battery is below 80, opacity is 0. And so on.

I’ve opened up Inspection Mode. Have a look…

would you be so kind as to explain the code to me please?
I don’t learn everything just by copying.

ok.
Take the 1st circle. I want it to dim between level 2 and level 20 of the battery (could also be 0-20). So the condition should be: if BLN bigger 2, then show a dimmed value. Below 2, value is 0.

At level 20 it should have opacity 100, so I need the opacity to be 5x20. If the battery level is 21, obviously, the formula will have opacity 5x21, but I don’t care. In the opacity field anything bigger 100 will be the same as 100.

The 2nd circle, I want it to dim between 20-40, so at level 40, the opacity needs to be 100, so BLNx2.5.

and so on, hope I made some sense …

I understand that

but how do I calculate the * value?
if i want to use 16 fields, i have to use different values.

Ah, I think I understand

100% visibility : batt % = * value

ah yes, then each circle will be a factor of 16.
So first one would between 0-6.25. BLNx100/6.25 (or BLNx16)

Second one is 6.25-12.5, BLNx100/12.5

Third one 12.5-18.75, BLNx100/18.75

Forth one 18.75-25, BLN*100/25

I just ask myself one question…
the dimming is evenly distributed among all, right?
i.e. the dimming is always calculated from the entire 100% of the battery…

So I have no real dimming only from the sub-area

Batt Part Display 80-100% Batt
smooth dimming from 100-0% visibility

at 90% batt the visibility should be 50%
at 85% batt = visibility 25%

yes, correct, if you want non linear dimming, then the math becomes more complicated, probably logrithmic or something

the precise calculation of the partial areas would therefore be too complex and imprecise

I understand

thank you for your help and your patience

Hi,

is there a way to modify the code, so the circle doesn’t start dimming ubtil it drops to 60%? Or is there another way to keep the circle at full opacity longer? (with dimming between 60 - 20%)

RN, I’m using a slightly modified code to make the gem dim until 20%, as the battery depletes
$#BLN#>=20?#BLN#:0$

Goal is to postpone the dimming, so the gem remains at full opacity (=full glow) until it drops below 60%, then it starts going dark.

1 Like

Are you talking about the gem in the centre . Not that it makes any difference . If it was a liner solution I would take the Battery count down from something like 160 . Easier if I show you . I am intrigued to see how your Formula works . Just dimming something is not the best data but good for character . I would have some sort of pointer .
.
.
Here is a basic test . I have better Fading formulas for three layers. Red and Green do not mix well Blue and Red do . See the number that can be changed 400 gives a fade starting at 25% 200 Gives 50% etc .
I presume oy know how to inspect this Face To get the Formula .
.
.

1 Like

Thanks, thad did the trick. There are some points in the code, that I don’t understand, why do I get different results by removing brackets? Also, what’s the correlation between the number and the point the gem starts fading?

I didn’t think of giving accurate data on the battery, the gems were supposed to be the energy source of magickal machinery. The dimming is simply the gem running out of energy.

1 Like

No it is all good what you are doing .
I use Brackets on everything Because I am not a Mathematician . If you know what you are doing in maths you know the Precedence of the operands . So which is done first + or * . I can not remember , so the most nested maths is done first . ( in the Middle ) The first part makes the Battery percent into a number between 0 and 1 .Then multiply that by say 400 . That gives you a number 400 to 0 imitating the battery percent . While the number is over 100 it will be Full Opacity . In the case of 400 it will start to fade at 25% . As you may Imagine there ar many more complex ways of doing it . Start Here .
Play with these number in a Text box or apply it to the rotation of a seconds hand and you can see what is happening to the numbers .

3 Likes

Just a suggestion . On your compass if if you do it again do not rotate the moonstone you could flash it like this with the motion of the pointer . In the Draft you will see I used the accelerometer.
.
.