Processing Code Responce

ballerina1pixeldance1pixeldancepixeldance2pixeldance3pixeldance4

I chose to explore what could be done with pixels from uploaded to processing images.

Here is a page from Processing website i studied:

https://processing.org/tutorials/pixels/

The idea of exploding pixels in 3d space looks like the perfect respond to the performance I chose last week.

PImage img;

void setup() {
size(300, 300, P3D);
img = loadImage(“ballerina1.jpg”);

}

void draw() {
background(0);
loadPixels();
for ( int x = 0; x < width;x++) {
for ( int y = 0; y < height;y++) {
int loc = x + y*width; // Pixel array location
color c = img.pixels[loc]; // Grab the color
// Calculate a z position as a function of mouseX and pixel brightness

// the brighter the pixel the more it moves to the front
float z = (mouseX/(float)width) * brightness(img.pixels[loc]) – 300.0;

//float z = (500/(float)width) * brightness(img.pixels[loc]) – 300.0;

// Translate to the location (moves pixel), set fill and stroke, and draw the rect
pushMatrix();
translate(x,y,z);
fill(c);
noStroke();
//rectMode(CENTER);
rect(0,0,1,1);
popMatrix();
}
}
// saveFrame(“pixeldance.jpg”); // saves the image
}

 

https://github.com/MrsScrew/DigitalCraft2017Spring/tree/master/Pix

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s