Exercises week 9

This commit is contained in:
Andrea Bianchi 2025-04-20 12:22:46 +09:00
parent bf2be407e4
commit 9ee08698cc
20 changed files with 180227 additions and 0 deletions

View File

@ -0,0 +1,11 @@
html,
body {
margin: 0;
/* padding: 5px; */
align-items: center;
text-align: center;
background-color: beige;
}
canvas {
display: block;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<script src="js/p5.js"></script>
<script src="js/p5.dom.min.js"></script>
<script src="js/p5.sound.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<script src="sketch.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<meta charset="utf-8" />
</head>
<body></body>
</html>

3
w9_lights_classes/js/p5.dom.min.js vendored Normal file

File diff suppressed because one or more lines are too long

90025
w9_lights_classes/js/p5.js Normal file

File diff suppressed because one or more lines are too long

28
w9_lights_classes/js/p5.sound.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,20 @@
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');
}
class Light {
}
function setup() {
createCanvas(400, 300);
console.log(images);
}
function draw() {
background(255);
}

View File

@ -0,0 +1,11 @@
html,
body {
margin: 0;
/* padding: 5px; */
align-items: center;
text-align: center;
background-color: beige;
}
canvas {
display: block;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

21
w9_lights_obj/index.html Normal file
View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<script src="js/p5.js"></script>
<script src="js/p5.dom.min.js"></script>
<script src="js/p5.sound.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<script src="sketch.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<meta charset="utf-8" />
</head>
<body></body>
</html>

3
w9_lights_obj/js/p5.dom.min.js vendored Normal file

File diff suppressed because one or more lines are too long

90025
w9_lights_obj/js/p5.js Normal file

File diff suppressed because one or more lines are too long

28
w9_lights_obj/js/p5.sound.min.js vendored Normal file

File diff suppressed because one or more lines are too long

31
w9_lights_obj/sketch.js Normal file
View File

@ -0,0 +1,31 @@
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(400, 300);
console.log(images);
}
function draw() {
background(255);
}