Fri Jan 31, 2014
This is a semi-automated backup of my old Tumblr account.
Minimal drawing program with undo
01/31/2014
// Minimal drawing program with undo
// Press 'z' to undo
// OOP version with undo and redo: http://git.io/ecEXiQ
// Note: there is a bug affecting Chrome 32 and Processing.js 1.4.1
// http://processing-js.lighthouseapp.com/projects/41284-processingjs/tickets/2066
// In Chrome 32, open this post alone and scroll to the top.
int levelsOfUndo = 10;
int currImageId = 0;
// circular array of images where to store undo levels
PImage[] images = new PImage[levelsOfUndo];
void setup() {
size(500, 500);
background(255);
// Initialize all undo levels
for(int i=0; i<levelsOfUndo; i++) {
images[i] = createImage(width, height, RGB);
// undo levels are initialized as copies of the blank screen
images[i] = get();
}
}
void draw() {
if(mousePressed) {
line(mouseX, mouseY, pmouseX, pmouseY);
}
}
void mousePressed() {
// increase the pointer of a circular array
currImageId = (currImageId + 1) % levelsOfUndo;
}
void mouseReleased() {
// save a copy of the display
images[currImageId] = get();
}
void keyPressed() {
if(key=='z') {
// decrease the pointer of a circular array
currImageId = (currImageId - 1 + levelsOfUndo) % levelsOfUndo;
// bring back an old image
image(images[currImageId], 0, 0);
}
if(key=='s') {
saveFrame("image####.png.webp");
}
}
TV glitch (photo)
01/30/2014
Digital TV is so much better.
Avoid II
01/29/2014
The program draws slightly curved lines while looking ahead. If it sees it’s going to crash into another line, it turns, calculating how much to turn to avoid the crash. Often, it turns to the side with more open space. But other times it does not care about what I say and just turns in the direction it feels like. Sometimes it can not avoid crashing. In those cases it waits for me with a silly smile in its registers.
I guide this young inexperienced program in its drawings. In turn, it gives me little surprises me with its pseudo-random decisions.
Lines that try to avoid collisions
01/29/2014
russellhay asked: On the “avoiding crashes” line sketch, how do you know it’s going to run into a line? Do you keep the location of everything you draw or do you pixel peep?
A: Pixel peeping! hehe I like that term. I guess that’s what I do :) For a more precise peeping, you can keep a copy of the image you generate in black and white without any effects. Actually, that could be seen as keeping the location of everything you draw. Just the data is not coordinates, but pixels.
Avoid I
01/28/2014
P5 Tweet 18
01/24/2014
// Processing Tweet #18. // Open this post to see the code run.
int i, w=500; void setup(){ size(w, w); } void draw(){ fill(w, 0, 0, 7); stroke(++i & 255); bezier(i%w, 0, i%(w+13), w/2, i/w*i%(w+33), w/2, i%(w+87), w); }
Running Processing in Tumblr
01/23/2014
Hue similarity
01/18/2014
Processed girls. Lines that follow hue similarity.
I shot the photos a few years ago in a fashion show.
Skateboarder GPS data
01/09/2014
Collaboration with Pedro Aires Marques.
Image based on skateboarder gps data.
According to Friedman (2008) the “main goal of data visualization is to communicate information clearly and effectively through graphical means.”
This is not data visualization, but it feels nice.
Connect the dots
01/07/2014
30c3
01/03/2014
61 seconds of video.
01/02/2014
Lasered laptop
01/01/2014
I recorded a video that included Blinkenlights and electronic components that were lying on a table. Then I wrote a Processing program that analysed that video and generated an image full of lines. I placed my laptop in a box, and the image was engraved with a laser. It was a bit scary to see smoke and flames coming out of my laptop, but now I have a unique laptop :)