1
0
Fork 0

[thunder] Show lightning image in dark themes

Signed-off-by: James Taylor <jt-git@nti.me.uk>
master
James Taylor 2024-04-24 22:03:33 +01:00
parent 7a3e0d2e7e
commit c7099bc34a
3 changed files with 18 additions and 11 deletions

View File

@ -1,2 +1,3 @@
0.01: New App!
0.02: Use locale module to display distance
0.03: Fix lightning image and flash button

View File

@ -22,7 +22,7 @@ var layout = new Layout( {
{type:"txt", pad:8, font:"20%", label:"", id:"distance", fillx:1},
{type:"h", c: [
{type:"btn", font:"6x8:2", label:"Flash", cb: l=>flash() },
{type:"img", pad:4, src:require("heatshrink").decompress(atob("h0awkBiMQBAQFBAxwdDAoIGKCYQGGFBQTCAyIAPgIGGIAoFCAxITDAxIFDAxATEJwIMEAw4TEAwo")) },
{type:"img", pad:4, src:atob("DhoBH+B/gf4P8D/A/gP4H+B/AfwH8B//////7/+A/APwD4A+APADwA4AcAHABgAYAA==") },
{type:"btn", font:"6x8:2", label:"Boom", cb: l=>boom() }
]},
]
@ -79,21 +79,27 @@ const renderIntervalCallback = function() {
updateTimeAndDistance();
};
const flash = function() {
Bangle.buzz(50, 0.5);
startTime = startTime = Date.now();
updateTimeAndDistance();
renderIntervalId = setInterval(renderIntervalCallback, 100);
};
const boom = function() {
const flashAndBoom = function() {
Bangle.buzz(50, 0.5);
if (renderIntervalId !== undefined) {
clearInterval(renderIntervalId);
renderIntervalId = undefined;
}
};
const flash = function() {
flashAndBoom();
startTime = undefined;
updateTimeAndDistance();
startTime = Date.now();
renderIntervalId = setInterval(renderIntervalCallback, 100);
};
const boom = function() {
flashAndBoom();
updateTimeAndDistance();
startTime = undefined;

View File

@ -1,7 +1,7 @@
{ "id": "thunder",
"name": "Come on Thunder",
"shortName":"Thunder",
"version":"0.02",
"version":"0.03",
"description": "Simple timer to calculate how far away lightning is",
"icon": "app.png",
"tags": "tool,weather",