lights exercise
This commit is contained in:
32
w9_lights_obj/sketch.js
Normal file
32
w9_lights_obj/sketch.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const images = {};
|
||||
|
||||
// We used this in P5.js (in Vite we would simply import the assets)
|
||||
function preload() {
|
||||
images.lightOn = loadImage('data/lightOn.jpg');
|
||||
images.lightOff = loadImage('data/lightOff.jpg');
|
||||
}
|
||||
|
||||
const light = {
|
||||
init: function (x, width) {
|
||||
/* ... */
|
||||
},
|
||||
toggle: function () {
|
||||
/* ... */
|
||||
},
|
||||
isOn: function () {
|
||||
/* ... */
|
||||
},
|
||||
draw: function () {
|
||||
/* ... */
|
||||
},
|
||||
};
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 600);
|
||||
// createCanvas(400, 300);
|
||||
console.log(images);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
background(255);
|
||||
}
|
||||
Reference in New Issue
Block a user