xxxxxxxxxx
64
let imga;
let img2;
let img3;
let one;
let two;
function preload() {
imga = loadImage("image1.jpg");
img2 = loadImage("image2.jpg");
}
function setup() {
createCanvas(400, 400);
pixelDensity(1);
}
function draw() {
fill(0, 255, 0);
rect(0,0, width, height)
// two = image(img2, 0, 0, width, height)
// one = image(img1, 0, 0, width, height)
imga.loadPixels()
for (let x = 0; x < width; x = x + 3) {
for (let y = 0; y < height; y++) {
//let i = (width * y + x) * 4;
//pixels[i + 3] = 100
let c = color(255, 0, 0, 0)
imga.set(x,y,c)
}
}
// for (let x = 1; x < width; x = x + 3) {
// for (let y = 0; y < height; y++) {
// let i = (width * y + x) * 4;
// pixels[i + 3] = 0
// }
// }
// for (let x = 2; x < width; x = x + 3) {
// for (let y = 0; y < height; y++) {
// let i = (width * y + x) * 4;
// pixels[i + 0] = 255
// pixels[i + 3] = 255
// }
// }
img1.updatePixels()
}