Merge pull request #3746 from MomentumV/master

DayMoon 0.05 release
master
thyttan 2025-02-13 20:10:20 +01:00 committed by GitHub
commit d782914f88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 200 additions and 151 deletions

View File

@ -2,3 +2,4 @@
0.02: move moon down, rotate sunrise/sunset, shift Hours/minutes to corners
0.03: Change day and night to have different dots
0.04: Update ChangeLog, coerce dark theme
0.05: Add more screenshots, fix bug in dot colors

View File

@ -8,10 +8,12 @@ This uses the myLocation app to get your latitude and longitude for proper dayli
Feature roadmap:
- [x] 0.01 Fix blocking widgets
- [x] 0.03 Day and Night different color markers
- [ ] 0.05 add Day of week and month display
- [ ] 0.06 Seconds display
- [ ] 0.07 Color Themes (and settings/options)
- [ ] 0.08 Moon display angle represents how it looks in the sky
- [x] 0.04 Add to App Loader
- [x] 0.05 Add more screenshots with different moon phases
- [ ] 0.06 add Day of week and month display
- [ ] 0.07 Seconds display
- [ ] 0.08 Color Themes (and settings/options)
- [ ] 0.09 Moon display angle represents how it looks in the sky
- [ ] 0.10 custom/bigger/fitted time digits
- [ ] 0.20 clockinfo support?
- [ ] 0.30 Tap/swipe actions?

View File

@ -25,7 +25,11 @@ const TAU = 2.0 * Math.PI;
const MX = g.getWidth() / 2,
MY = 24 + 3 + RADII.arcMax;
const DAY_MILLIS = 86400000;
const M_POS = { x: MX, y: MY, r: RADII.moon };
const M_POS = {
x: MX,
y: MY,
r: RADII.moon
};
// images
const moon_texture = {
width: 80,
@ -36,10 +40,10 @@ const moon_texture = {
};
const needle = {
width: 23,
height: 11,
height: 10,
bpp: 1,
transparent: 0,
buffer: atob("///B///D///AAAPAAAHAAAHAAAcAADz///H//8P//wA=")
buffer: atob("//+B///D///AAAHgAADgAAHAAA9///j//+H//gA=")
};
/*
@ -52,13 +56,19 @@ const needle = {
// requires the myLocation app
function loadLocation() {
location = require("Storage").readJSON(LOCATION_FILE, 1) || { "lat": 45, "lon": -71.3, "location": "Nashua" }; //{"lat":51.5072,"lon":0.1276,"location":"London"};
location = require("Storage").readJSON(LOCATION_FILE, 1) || {
"lat": 45,
"lon": -71.3,
"location": "Nashua"
}; //{"lat":51.5072,"lon":0.1276,"location":"London"};
}
function drawMoon(shadowShape) {
g.setColor(0, 0, 0).fillCircle(MX, MY, RADII.arcMax + 3);
g.setColor(COL.moon).fillCircle(MX, MY, RADII.moon);
g.setColor(COL.txture).drawImage(moon_texture, MX, MY, { rotate: 0 });
g.setColor(COL.moon).fillCircle(MX, MY, RADII.moon - 1);
g.setColor(COL.txture).drawImage(moon_texture, MX, MY, {
rotate: 0
});
// TODO: can set the rotation here to the parallacticAngle from getMoonPosition
g.setColor(COL.shadow).fillPoly(shadowShape);
// TODO: set rotation of the fillPoly? parallactic-mp.angle I think.
@ -94,13 +104,21 @@ function drawDayRing(times) {
}
for (var i = 0; i < 24; i++) {
let a = i * TAU / 24;
if (!flag && a > edges[0]) {
if (!flag && a > edges[0] && a < edges[1]) {
//first cross
if (isDay) { g.setColor(COL.ndots); } else { g.setColor(COL.ddots); }
if (isDay) {
g.setColor(COL.ndots);
} else {
g.setColor(COL.ddots);
}
flag = true;
} else if (flag && a > edges[1]) {
//second cross
if (isDay) { g.setColor(COL.ddots); } else { g.setColor(COL.ndots); }
if (isDay) {
g.setColor(COL.ddots);
} else {
g.setColor(COL.ndots);
}
flag = false;
}
let dotSize = (i % 3 == 0) ? 2 : 1;
@ -147,7 +165,7 @@ function moonShade(pos, mp) {
let isWaxing = (mp.phase < 0.5);
s1 = isWaxing ? -1 : 1;
s2 = isWaxing ? 1 - 2 * k : 2 * k - 1;
let tr = (pos.r + 0.5);
let tr = (pos.r + 1);
for (var i = 0; i < pts; i++) {
// down stroke on the outer shadow
var t = i * Math.PI / (pts + 1); //pts+1 so we leave the last point for the starting of going up
@ -167,24 +185,44 @@ function tToRad(date) {
return (milli / DAY_MILLIS + 0.25) * TAU;
}
function draw() {
// work out how to display the current time
var d = new Date(),
a = tToRad(d);
var shape = moonShade(M_POS, SunCalc.getMoonIllumination(d));
var sTimes = SunCalc.getTimes(d, location.lat, location.lon);
var daylight = [sTimes.sunrise, sTimes.sunset];
function draw(date) {
var d = date !== undefined ? date : new Date();
var a = tToRad(d),
shape = moonShade(M_POS, SunCalc.getMoonIllumination(d)),
sTimes = SunCalc.getTimes(d, location.lat, location.lon),
daylight = [sTimes.sunrise, sTimes.sunset];
//clear time area
g.setColor(0).fillRect(0, 176 - 45, 176, 176);
g.clearRect(Bangle.appRect); //g.setColor(0).fillRect(0, 176 - 45, 176, 176);
drawMoon(shape);
drawDayRing(daylight);
drawHHMM(d);
// draw pointer
// TODO: Maybe later make this an overlay that can be removed?? -avoid drawing so much every minute/second
g.setColor(COL.needle).drawImage(needle, MX + RADII.needle * Math.cos(a), MY + RADII.needle * Math.sin(a), { rotate: a });
g.setColor(COL.needle).drawImage(needle, MX + RADII.needle * Math.cos(a), MY + RADII.needle * Math.sin(a), {
rotate: a
});
}
/*
const shotTimes = [1720626960000, 1729184400000, 1738298880000, 1717575420000];
let desc =`first quarter -2 days moon at 10:20 in the summer
jun 10 2024 10:56
full moon at 12 noon near fall equinox
Sep 17 2024 12:00
new moon at 11pm in winter
dec 30 2024 23:48
3rd quarter moon at 03:17 am
May 5 2024 03:17`
function screenshots(times) {
let d = new Date();
for (let t of times) {
d.setTime(t);
draw(d);
g.dump();
}
}
*/
// Clear the screen once, at startup
g.reset();
// requires the myLocation app
@ -210,5 +248,13 @@ widgets know if they're being loaded into a clock app or not */
Bangle.setUI("clock");
// Load widgets
Bangle.loadWidgets();
g.setTheme({fg:"#fff", bg:"#000", fg2:"#fff", bg2:"#004", fgH:"#fff", bgH:"#00f", dark:true });
g.setTheme({
fg: "#fff",
bg: "#000",
fg2: "#fff",
bg2: "#004",
fgH: "#fff",
bgH: "#00f",
dark: true
});
Bangle.drawWidgets();

View File

@ -1,10 +1,10 @@
{ "id": "daymoon",
"name": "DayMoon Circadian Clock",
"version": "0.04",
"version": "0.05",
"dependencies": {"mylocation":"app"},
"description": "A 24 hour clockface showing the Moon Phase and portion of the day that the Sun is up inspired by Matthew Clark's *Fair Circadian* Pebble watchface",
"icon": "daymoon.png",
"screenshots": [{"url":"screenshot.png"}],
"screenshots": [{"url":"s1.png"},{"url":"s2.png"},{"url":"s3.png"},{"url":"s4.png"}],
"type": "clock",
"tags": "clock,moon,lunar",
"supports": ["BANGLEJS2"],

BIN
apps/daymoon/s1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
apps/daymoon/s2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
apps/daymoon/s3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
apps/daymoon/s4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB