Hallo everyone im now making my own Clock in p5js and want it to change between 3 different timezones but i dont know how it works and i need your help for this matter i would be very happy for your help The Code is as follows:
let bg;
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
textAlign(CENTER);
background(100);
}
function draw() {
let hr = hour();
let min = minute();
let sc = second();
selectTimeZone();
background('black');
imageMode(CENTER);
image(bg, width/2, height/2, width, height)
translate(200, 200);
rotate(-90);
//noFill();
//fill(255);
//noStroke();
strokeWeight(8);
stroke(243, 435, 767);
let end=map(sc, 0, 60, 0, 360);
arc(0, 0, 300, 300, 0, end);
strokeWeight(8);
noFill();
stroke(2, 435, 767);
let end2=map(min, 0, 60, 0, 360);
arc(0, 0, 280, 280, 0, end2);
strokeWeight(8);
noFill();
stroke(3, 435, 767);
let end3=map(hr % 12, 0, 12, 0, 360);
arc(0, 0, 260, 260, 0, end3);
push();
rotate(end);
stroke(243, 435, 767);
line(0, 0, 100 ,0);
pop();
push();
rotate(end2);
stroke(2, 435, 767);
line(0, 0, 75 ,0);
pop();
push();
rotate(end3);
stroke(3, 43, 767);
line(0, 0, 50 ,0);
pop();
}
function preload()
{
bg = loadImage('mdvmefeejg331.jpg');
}
function selectTimeZone() {
sel = createSelect();
sel.position(400,20);
sel.option('Deutschland');
sel.option('Turkey');
sel.option('Iran');
fill(0);
noStroke();
textSize(40);
}
function mySelectEvent() {
country = sel.value();
}
I searched the whole web but didnt find anything about this even no mention in the references Thanks in advance for your help
I'm not aware of any automatic time zone changing function or library in p5.js. If I were to do this, I would do it manually, which is a huge pain. Here's what I would do:
utc
with UTC hour (calculate based on your time and the difference between your time and UTC).Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments