xxxxxxxxxx
var img;
function preload() {
// 500 x 500 px
img = loadImage("Portrait.jpg");
}
function setup() {
createCanvas(1280, 720, SVG);
frameRate(20);
noLoop();
}
function draw() {
background(255);
//image(img, 0, 0);
img.loadPixels();
beginShape();
for (var y = 0; y < img.height; y += 10) {
//beginShape();
for (var x = 0; x < img.width; x += 10) {
//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(0);
//beginShape();
noFill();
stroke(0);
//noStroke();
//rotate(red(c));
ellipseMode(CENTER);
ellipse(0, 0, x/30, red(c)/20);
//rectMode(CENTER);
//rect(0,0, x/30, red(c)/20);
//rect(0,0, red(c)/20, red(c)/10);
//line(0,0,10,red(c)/10);
//arc(0, 0, 20, 20, 0, red(c)/50);
//curveVertex(x, y+ red(c)/6);
pop();
}
endShape();
}
}
function keyPressed()
{
noLoop();
save();
}