Shows night time on the map

pull/2431/head
Alain Saas 2022-12-28 10:53:18 -05:00 committed by GitHub
parent 1f1b8a20d5
commit 6c2d266bb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -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();