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

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);
}