Battery level using TrianguloY ‘s script
Battery level using TrianguloY ‘s script
So from red when low to green when high
drawarc( $bat_level,100, Color.HSVToColor([animate(“$bat_level”)/100*120,1,1]), 2, 0.3, 0.4);
]]>« Pierre Hébert did you already know AndroidJSCore?? (Previous Post)
< ![CDATA[
Ehm … You need to write the whole binding and change the medium part with that function, otherwise I’m not sure what it will draw, and where.
Edit: due to the small the editing box is, probably the whole binding is there, but out of view. I’ll keep this comment for future reference.
]]>
< ![CDATA[
TrianguloY it’s included in your script 🙂 And working fine
]]>
< ![CDATA[
TrianguloY is it possible to write the value at the end of the arc ?
Like hour number on the arc for hour, minute on the arc for minutes… Like in the polarClock
]]>
< ![CDATA[
Try this:
Add this code to the end of the binding
——————
function drawText(n,max,color,width,from,to){
p.setColor(color);
p.setStrokeWidth(width);
p.setTextAlign(Paint.Align.CENTER)
p.setTextSize((to-from)*w);
p.setStyle(Paint.Style.FILL);
ang = n / max * 2 * Math.PI;
at=(from+to)/2;
c.drawText(
n
,w + Math.sin(ang) * w * at
,w – Math.cos(ang) * w * at + (to-from)*w/2
,p);
p.setStyle(Paint.Style.STROKE);
}
—————–
And then use this to draw the text (the same parameters as arc and lines)
drawText($ll_second , 60 , Color.WHITE , 1 , 0.85 , 1);
]]>
< ![CDATA[
Sounds great
I’ll try
]]>