diff --git a/apps/binaryclk/app-icon.js b/apps/binaryclk/app-icon.js new file mode 100644 index 000000000..3cb526a4f --- /dev/null +++ b/apps/binaryclk/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwhC/AEUiAAQEEkECBRAX/C/4Xrd+hCDI4kgR/4X/C/4XIAF53/C/4X/A4gSDC4kgC5AAvR/4X/C/4A/ADoA==")) diff --git a/apps/binaryclk/app-icon.png b/apps/binaryclk/app-icon.png new file mode 100644 index 000000000..b28ffdab4 Binary files /dev/null and b/apps/binaryclk/app-icon.png differ diff --git a/apps/binaryclk/app.js b/apps/binaryclk/app.js new file mode 100644 index 000000000..0060edf98 --- /dev/null +++ b/apps/binaryclk/app.js @@ -0,0 +1,36 @@ +function draw() { + var dt = new Date(); + var h = dt.getHours(), m = dt.getMinutes(); + const t = []; + t[0] = Math.floor(h/10); + t[1] = Math.floor(h%10); + t[2] = Math.floor(m/10); + t[3] = Math.floor(m%10); + + g.reset(); + g.clearRect(Bangle.appRect); + + let i = 0; + const sq = 29; + const gap = 8; + const mgn = 20; + const pos = sq + gap; + + for (let r = 3; r >= 0; r--) { + for (let c = 0; c < 4; c++) { + if (t[c] & Math.pow(2, r)) { + g.fillRect(mgn/2 + gap + c * pos, mgn + gap + i * pos, mgn/2 + gap + c * pos + sq, mgn + gap + i * pos + sq); + } else { + g.drawRect(mgn/2 + gap + c * pos, mgn + gap + i * pos, mgn/2 + gap + c * pos + sq, mgn + gap + i * pos + sq); + } + } + i++; + } +} + +g.clear(); +draw(); +var secondInterval = setInterval(draw, 60000); +Bangle.setUI("clock"); +Bangle.loadWidgets(); +Bangle.drawWidgets(); diff --git a/apps/binaryclk/metadata.json b/apps/binaryclk/metadata.json new file mode 100644 index 000000000..fdc56b21a --- /dev/null +++ b/apps/binaryclk/metadata.json @@ -0,0 +1,16 @@ +{ + "id": "binaryclk", + "name": "Bin Clock", + "version": "0.01", + "description": "Clock face to show binary time in 24 hr format", + "icon": "app-icon.png", + "screenshots": [{"url":"screenshot.png"}], + "type": "clock", + "tags": "clock", + "supports": ["BANGLEJS2"], + "allow_emulator": true, + "storage": [ + {"name":"binaryclk.app.js","url":"app.js"}, + {"name":"binaryclk.img","url":"app-icon.js","evaluate":true} + ] +} diff --git a/apps/binaryclk/screenshot.png b/apps/binaryclk/screenshot.png new file mode 100644 index 000000000..57f95d8ab Binary files /dev/null and b/apps/binaryclk/screenshot.png differ