Did things

This commit is contained in:
Cametendo
2026-04-01 11:45:22 +02:00
parent adc8b47772
commit 97a7c9f0fb
15 changed files with 123 additions and 2 deletions

20
Day-1/index.html Normal file
View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sketch</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="libraries/p5.min.js"></script>
<script src="libraries/p5.sound.min.js"></script>
</head>
<body>
<script src="sketch.js"></script>
<a href="script_rectangles.html">Rectangles Script</a>
<a href="script_labyrinth.html">Labyrinth Script</a>
</body>
</html>

10
Day-2/image.js Normal file
View File

@@ -0,0 +1,10 @@
let img;
function preload() {
img = loadImage("Images/monitoring-miku.png");
}
function setup() {
createCanvas(720, 400);
image(img, 0, 0, 300, 300);
}

38
Day-2/pixels.js Normal file
View File

@@ -0,0 +1,38 @@
let img;
function preload() {
img = loadImage("Images/monitoring-miku.png");
}
function setup() {
createCanvas(600, 600);
pixelDensity(1);
}
function draw() {
background(0);
image(img, 100, 100, 400, 400);
/* img.loadPixels();
for (let i = 0; i < img.pixels.length; i += 4) {
let red = img.pixels[i + 0];
let green = img.pixels[i + 1];
let blue = img.pixels[i + 2];
let alpha = img.pixels[i + 3];
img.pixels[i + 0] = red;
img.pixels[i + 1] = green;
img.pixels[i + 2] = blue;
img.pixels[i + 3] = alpha;
}
img.updatePixels(); */
img.loadPixels();
for ( let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
const index = (x + y * width) * 4;
img.pixels[index + 0] = mouseX;
img.pixels[index + 1] = mouseY;
img.pixels[index + 2] = y;
img.pixels[index + 3] = 100;
}
}
img.updatePixels();
}

32
Day-2/styleSettings.js Normal file
View File

@@ -0,0 +1,32 @@
function setup() {
createCanvas(100, 150);
background(0, 150, 0);
ellipse(0, 50, 33, 33);
push();
translate(50, 0);
strokeWeight(10);
fill(204, 153, 0);
ellipse(0, 50, 33, 33);
pop();
ellipse(100, 50, 33, 33);
translate(0, 50);
ellipse(0, 50, 33, 33);
push();
strokeWeight(10);
fill(204, 153, 0);
ellipse(33, 50, 33, 33);
push();
stroke(0, 102, 153);
ellipse(66, 50, 33, 33);
pop();
pop();
ellipse(100, 50, 33, 33);
}

13
Day-2/transformations.js Normal file
View File

@@ -0,0 +1,13 @@
function setup() {
createCanvas(800, 800);
background(200);
fill(150, 0, 0);
rect(0, 0, 60, 150);
translate(200, 120);
rotate(0.5);
scale(1.5);
fill(0, 150, 0);
rect(0, 0, 60, 150);
}

BIN
Images/monitoring-miku.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

@@ -14,7 +14,5 @@
<body> <body>
<script src="sketch.js"></script> <script src="sketch.js"></script>
<a href="script_rectangles.html">Rectangles Script</a>
<a href="script_labyrinth.html">Labyrinth Script</a>
</body> </body>
</html> </html>

10
sketch.js Normal file
View File

@@ -0,0 +1,10 @@
let img;
function preload() {
img = loadImage("Images/monitoring-miku.png");
}
function setup() {
createCanvas(800, 800)
image(img, 0, 0, mouseX, mouseY);
}