xxxxxxxxxx
var img;
function preload() {
// 500 x 500 px
img = loadImage("Portrait.jpg");
}
function setup() {
createCanvas(1280, 720);
background(0);
noLoop();
}
function draw() {
background(0);
//image(img, 0, 0);
img.loadPixels();
for (var y = 0; y < img.height; y += 15) {
for (var x = 0; x < img.width; x += 15) {
var c = img.get(x, y);
// Fast but complicated
//var c = color(img.pixels[(y*img.width+x)*4]);
push();
translate(x, y);
//rotate(radians(red(c)));
fill(c);
noFill();
stroke(c);
//noStroke();
rotate(red(c));
//ellipseMode(CENTER);
//ellipse(0, 0, x/30, red(c)/20);
rectMode(CENTER);
rect(0,0, x/30, red(c)/20);
//arc(0, 0, 20, 20, 0, red(c)/50);
pop();
}
}
}