sketch.js: initial support for dark/light mode logic

This commit is contained in:
tym2k1 2025-02-22 13:47:03 +01:00
parent f41b131563
commit cf5b81ec8b
No known key found for this signature in database
GPG key ID: 409330E8D7E4BF83

View file

@ -42,7 +42,7 @@ class RotatingOnion {
scale(this.scale);
model(onion_stroke);
push()
emissiveMaterial(0,0,0)
emissiveMaterial(backgroundColor)
model(onion_fill);
pop()
@ -191,6 +191,9 @@ function setup() {
textAlign(CENTER, CENTER);
randomSeed()
// Background color
backgroundColor = [0, 0, 0];
// Initialize camera to get its position
camera = createCamera();
@ -216,7 +219,7 @@ function setup() {
}
function draw() {
background(0);
background(backgroundColor);
orbitControl();
ambientLight(100);
shininess(0);