# Code Explanations?

so i havent done any research on this or looked for threads that say it

but i was wondering if anyone can explain how the codes workâ€¦ like an explanation on codes and how they work and why they are typed the way the are as well as where to put them in because i havent figured that part out.

for exampleâ€¦ to change the battery from the regular percentage to a battery bar or circle and how to implement a image or a bar that goes down as the percentage goes downâ€¦

forgive me for i am but a simpleton and new to this whole thing but i would like to get more information and knowledge on how to do this type of stuff so i can create some tasteful pieces of art lol

Hello @PharaohG,

I did prepared some basic coding for battery as you describe it. Please try to check this link.

General coding explanation could looks like this.

Have a lot of fun creating new watch faces

5 Likes

That is exactly what i was wanting to see lol seeing the code without the explanation is like trying to read hieroglyphics.
and i saw the battery information but what is it that changes from being a bar to being a circle and etc

Good Help, Tomas.

Well done @Tomas. Way to spread the joy.

1 Like

Battery bar is easy. very easy if you use 0-100 as an absolute value. You input the battery Integer tag into the H or W value field.H and W are essentially Pixel sizes. so full value of 100 is 100 pixels. You can manipulate this with mathematics.

BatIntegerTag*1.05 will make your bar 5% longer in your chosen direction. First one I did that with (A Trusty Steed) was just that for both phone and watch batts. I put a background bar that was a slight bit wider and taller so that it gives the user an idea of what the bar represents. If you only have the battery bar without a background they will have a hard time understanding what the display means for actual value. To pull off a half circle the multiplier is 1.8 soâ€¦

what value is thisâ€¦ (_____ is for alignment)

Power Bar_____ ------

?

50% But you have no reference to determine that.

Nowâ€¦

What value is This?

Power Bar____ ------------
Background Bar======================

around 28%

Always need a reference when you go with something not obvious. Years of building houses and a few other careers taught me this.