mirror of https://github.com/espruino/BangleApps
actually fixed spacing
parent
ef3087ac4b
commit
af6108de4e
|
@ -1,31 +1,31 @@
|
||||||
function draw() {
|
function draw() {
|
||||||
var dt = new Date();
|
var dt = new Date();
|
||||||
var h = dt.getHours(), m = dt.getMinutes();
|
var h = dt.getHours(), m = dt.getMinutes();
|
||||||
const t = [];
|
const t = [];
|
||||||
t[0] = Math.floor(h/10);
|
t[0] = Math.floor(h/10);
|
||||||
t[1] = Math.floor(h%10);
|
t[1] = Math.floor(h%10);
|
||||||
t[2] = Math.floor(m/10);
|
t[2] = Math.floor(m/10);
|
||||||
t[3] = Math.floor(m%10);
|
t[3] = Math.floor(m%10);
|
||||||
|
|
||||||
g.reset();
|
g.reset();
|
||||||
g.clearRect(Bangle.appRect);
|
g.clearRect(Bangle.appRect);
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
const sq = 29;
|
const sq = 29;
|
||||||
const gap = 8;
|
const gap = 8;
|
||||||
const mgn = 20;
|
const mgn = 20;
|
||||||
const pos = sq + gap;
|
const pos = sq + gap;
|
||||||
|
|
||||||
for (let r = 3; r >= 0; r--) {
|
for (let r = 3; r >= 0; r--) {
|
||||||
for (let c = 0; c < 4; c++) {
|
for (let c = 0; c < 4; c++) {
|
||||||
if (t[c] & Math.pow(2, r)) {
|
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);
|
g.fillRect(mgn/2 + gap + c * pos, mgn + gap + i * pos, mgn/2 + gap + c * pos + sq, mgn + gap + i * pos + sq);
|
||||||
} else {
|
} else {
|
||||||
g.drawRect(mgn/2 + gap + c * pos, mgn + gap + i * pos, mgn/2 + gap + c * pos + sq, mgn + gap + i * pos + sq);
|
g.drawRect(mgn/2 + gap + c * pos, mgn + gap + i * pos, mgn/2 + gap + c * pos + sq, mgn + gap + i * pos + sq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g.clear();
|
g.clear();
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
{
|
{
|
||||||
"id": "binaryclk",
|
"id": "binaryclk",
|
||||||
"name": "Bin Clock",
|
"name": "Bin Clock",
|
||||||
"version": "0.01",
|
"version": "0.01",
|
||||||
"description": "Clock face to binary time in 24 hr format",
|
"description": "Clock face to binary time in 24 hr format",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"screenshots": [{"url":"screenshot.png"}],
|
"screenshots": [{"url":"screenshot.png"}],
|
||||||
"type": "clock",
|
"type": "clock",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"supports": ["BANGLEJS2"],
|
"supports": ["BANGLEJS2"],
|
||||||
"allow_emulator": true,
|
"allow_emulator": true,
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":"binaryclk.app.js","url":"app.js"},
|
{"name":"binaryclk.app.js","url":"app.js"},
|
||||||
{"name":"binaryclk.img","url":"app-icon.js","evaluate":true}
|
{"name":"binaryclk.img","url":"app-icon.js","evaluate":true}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue