clear before redraw

master
thyttan 2022-11-14 22:57:49 +01:00
parent f0a270b1b2
commit 96a7ccd8c5
3 changed files with 4 additions and 2 deletions

View File

@ -1 +1,2 @@
0.01: New app
0.02: Clear between redraws

View File

@ -1,7 +1,7 @@
{
"id": "widanclk",
"name": "Analog clock widget",
"version": "0.01",
"version": "0.02",
"description": "A simple analog clock widget that appears when not showing a fullscreen clock",
"icon": "widget.png",
"type": "widget",

View File

@ -12,7 +12,8 @@ WIDGETS["wdanclk"]={area:"tl",width:Bangle.CLOCK?0:24,draw:function() {
let x=this.x+12, y=this.y+12,
ah = (d.getHours()+d.getMinutes()/60)*Math.PI/6,
am = d.getMinutes()*Math.PI/30;
g.drawCircle(x, y, 11).
g.clearRect(this.x, this.y, this.x+this.width-1, this.y+23).
drawCircle(x, y, 11).
drawLine(x,y, x+Math.sin(ah)*7, y-Math.cos(ah)*7).
drawLine(x,y, x+Math.sin(am)*9, y-Math.cos(am)*9);
// queue draw in one minute