Created
October 28, 2012 00:50
-
-
Save jurisgalang/3967058 to your computer and use it in GitHub Desktop.
Fuzzy tile image rendering in Processing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PImage image = loadImage("/Users/jgalang/Desktop/yoko2.jpg"); | |
void setup() { | |
if (image.height != displayHeight) { | |
//image = image.get(); | |
image.resize(0, displayHeight); | |
//image.loadPixels(); | |
} | |
size(image.width, displayHeight, P3D); | |
background(255); | |
smooth(); | |
noStroke(); | |
} | |
float x = 0; | |
float y = 0; | |
float d = 1; | |
void draw() { | |
//pushMatrix(); | |
float w = random(10, 100); | |
float h = random(10, 100); | |
if (x < image.width) { | |
if ((y < image.height) && (y >= 0)) { | |
color c = image.pixels[(int)(abs(y) * width + x)]; | |
c = color(red(c), green(c), blue(c), random(15, 35)); | |
fill(c); | |
translate(x , abs(y)); | |
rotateZ(random(0, TWO_PI)); | |
rect(-(w / 2), -(h / 2), w, h, 5); | |
} | |
} | |
y += (d * 5); | |
if ((y > image.height) || (y < 0)) { | |
x += (w / 4); | |
if (x < image.width) d *= -1; | |
else noLoop(); | |
} | |
//popMatrix(); | |
} | |
boolean sketchFullScreen() { | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment