From cf5b81ec8b26af6d152305a25c81efc911ec5b49 Mon Sep 17 00:00:00 2001 From: Tymoteusz Burak Date: Sat, 22 Feb 2025 13:47:03 +0100 Subject: [PATCH] sketch.js: initial support for dark/light mode logic --- sketch.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sketch.js b/sketch.js index 1dcd51e..9cae4ec 100644 --- a/sketch.js +++ b/sketch.js @@ -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);