mirror of https://github.com/espruino/BangleApps
Shows night time on the map
parent
1f1b8a20d5
commit
6c2d266bb7
|
@ -107,6 +107,17 @@ function draw() {
|
|||
g.setColor('#ff0').drawLine(x_sun, g.getHeight()-IMAGEHEIGHT, x_sun, g.getHeight());
|
||||
g.reset();
|
||||
|
||||
var x_night_start = 176 - (((getGmt().getHours()-6)%24) / 24 * 176 + 4);
|
||||
var x_night_end = 176 - (((getGmt().getHours()+6)%24) / 24 * 176 + 4);
|
||||
for (let x = x_night_start; x < 176; x+=2) {
|
||||
g.setColor('#000').drawLine(x, g.getHeight()-IMAGEHEIGHT, x, g.getHeight());
|
||||
}
|
||||
if (x_night_end < x_night_start) {
|
||||
for (let x = 0; x < x_night_end; x+=2) {
|
||||
g.setColor('#000').drawLine(x, g.getHeight()-IMAGEHEIGHT, x, g.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
var locale = require("locale");
|
||||
|
||||
var date = new Date();
|
||||
|
|
Loading…
Reference in New Issue