aboutsummaryrefslogtreecommitdiff
path: root/P5
diff options
context:
space:
mode:
Diffstat (limited to 'P5')
-rw-r--r--P5/light.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/P5/light.js b/P5/light.js
index c60d225..20eb1c0 100644
--- a/P5/light.js
+++ b/P5/light.js
@@ -2,27 +2,27 @@
// SPDX-License-Identifier: GPL-3.0-or-later
let button;
-let bgColor; //a variable that keeps track of the background color
-let isBlack = true; //Starts with black
+let bgColor; // a variable that keeps track of the background color
+let isBlack = true; // Starts with black
function setup() {
createCanvas(800, 500);
- bgColor = color(15,15,60);
+ bgColor = color(15, 15, 60);
button = createButton("Color");
button.mouseClicked(changeBackground);
button.size(50, 50);
button.position(350, 210);
}
-function draw() {
+function draw() {
background(bgColor);
}
function changeBackground() {
if (isBlack) {
- bgColor = color(255, 223, 0); //Yellow
- }else {
- bgColor = color(15,15,60); //Black
+ bgColor = color(255, 223, 0); // Yellow
+ } else {
+ bgColor = color(15, 15, 60); // Black
}
- isBlack = !isBlack; //Changing between true and false
+ isBlack = !isBlack; // Changing between true and false
} \ No newline at end of file