xxxxxxxxxx
38
//Took inspiration from Mathew Mannings creation and some of the classwork to recreate a slow moving and devolving Windows XP screen saver image.
var XPimgArray = ["XP0.jpg", "XP1.jpg", "XP2.jpg"],
XPimg,
img,
dx,
dy,
r = Math.floor(Math.random() * XPimgArray.length),
imgNew = new Image();
// Pick an image
imgNew.src = XPimgArray[r];
//here I create the initial image that will slowly devolve
function setup() {
createCanvas(imgNew.naturalWidth, imgNew.naturalHeight);
img = loadImage(imgNew.src);
noStroke();
}
function draw() {
noStroke();
// noprotect
//taking the pixel value of the image and applying it to rectangles in a random fashion
for (var x = 0; x < 200; x += 3) {
for (var y = 0; y < 200; y += 3) {
//var pxCol = img.get(10, 10);
// var pxCol = img.get(x, y);
//pxCol[0] = pxCol[0];
//print(pxCol);
//fill(pxCol);
rect(x * 2, y * 2, random(1, 8));
//ellipse(x,y,5,5);
}
}
//noLoop();
}