xxxxxxxxxx
let myImage;
let x = 0;
let y = 0;
let brightness = 10;
function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
blendMode(SCREEN);
noStroke();
}
function preload() {
myImage = loadImage(
"https://images.unsplash.com/photo-1501785888041-af3ef285b470?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
);
}
function draw() {
let cellWidth = width/myImage.width*2;
let cellHeight = height/255*2
for (let i = 0; i < 1000; i++) {
if (y < myImage.height) {
let c = myImage.get(x, y);
fill(255,0,0,brightness);
ellipse(x*width/myImage.width, c[0]/255*height, cellWidth, cellHeight);
fill(0,255,0,brightness);
ellipse(x*width/myImage.width, c[1]/255*height, cellWidth, cellHeight);
fill(0,0,255,brightness);
ellipse(x*width/myImage.width, c[2]/255*height, cellWidth, cellHeight);
x++;
if (x > myImage.width) {
y++;
x = 0;
}
}
}
console.log(y/myImage.height*100 + '%')
}