xxxxxxxxxx
47
var t_d_s;
var t_d_m;
var time = 0;
var day_count = 1;
var night_count = 2;
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
sun = new Sun();
moon = new Moon();
t_d_s = 1000 / width / day_count;
t_d_m = 1000 / width / night_count;
}
function draw() {
// Earth
earth()
// Tree shadow
turtleShadow();
// Sky
sky();
// Tree
turtleTree();
console.log(1);
// Luminaries
if (time < width + 200) {
sun.update(t_d_s);
time += t_d_s;
}
else if (time < width * 2 + 400) {
moon.update(t_d_m);
time += t_d_m;
}
else {
time = 0;
sun.rezero();
moon.rezero();
}
}