DIY battery bar! It’s an empty icon, with a white background, that binding for the width, and a height of 5px
Posted by: pierrot | on April 14, 2017
DIY battery bar! It’s an empty icon, with a white background, that binding for the width, and a height of 5px
]]>
Posted in | 11 Comments »
Tags: David Sprinkle
(Next Post) Can I use a binding to an object’s background color? »
< ![CDATA[
When testing I changed 0.01 to 0.0001. Otherwise, the width get huge. But, I can’t understand how to make the height 5px.
]]>
< ![CDATA[
The width is supposed to be 100% battery equals 100% screen width. If you want it to not fill the whole screen, tweaking that works.
Is your object detached from the grid? Select it and use the + looking tool to set the height
]]>
< ![CDATA[
https://lh3.googleusercontent.com/fSNFSpNoxfplMRfUcww7LLOVZ9UbqL-LqomQFwkYyMWrEtBaM-fbs0X-E5GNfliCtzmhoX9iew
]]>
< ![CDATA[
You can even colorize your line from red to green depending on the battery percentage
https://lh3.googleusercontent.com/odI9cs2vNxvr-m4_ywHStYQiVEX1D-jUusSmTyo0qki6GGv2735HtP4mN4_noS_boh2J-VvgOD0
]]>
< ![CDATA[
That’s a great idea!
Here are binding codes for easier copy-paste :
Width : (($bat_level) * 0.01) * $screen_width
Normal color : Color.HSVToColor([animate(“$bat_level”)/100*120,1,1])
Visibility : $Home_top
Enjoy !
EDIT : I had to add spaces in Width line to prevent Markdown formating due to “*” caracters. You may have to remove them manullay
]]>
< ![CDATA[
Bruno-Isa LAMOUR-ARNOULD : how do you add the “%” symbol after battery percentage? When I edit text format and put “0 %” it shows 6500% instead of 65%.
Thanks
]]>
< ![CDATA[
($bat_level)+”%”
]]>
< ![CDATA[
If you make that the binding for the label of a text item, it should work
]]>
< ![CDATA[
Lionel SANCHEZ
https://lh3.googleusercontent.com/_Pilwk9TZczCIaykmOVzZn_FxglJAEdjlE–SGWrmJ6T34BXqM-AUEZleOX5enkLHVndgWDPCc4
]]>
< ![CDATA[
Bruno-Isa LAMOUR-ARNOULD​ thanks a lot. I tried the double quote but not the simple quote. 😅
PS : To have icon color changing regarding battery status you have to use “Colorize” binding.
]]>
< ![CDATA[
Lionel SANCHEZ​ normal color is what I’ve set and working fine about text.
Icon yes I know
]]>