I recently ordered Daniel Shiffman’s Learning Processing: A Beginner’s Guide to Programming Images, Animation, and Interaction for my Kindle. Completely different from using Inkscape, Processing is code-based. One of the early projects in the book is to design a creature/character entirely of rectangles, lines, ellipses, etc., and to figure out how to write the code to bring that creature to life, so to speak. My robot is no match for the Borg or Cyberdyne’s T808 series, alas. The code involved seemed counterintuitive at first, but I got faster with it as time went on. Here’s the robot:
My Processing Robot

And here’s the code:

// My robot

size(400,400);
background(255);
smooth();
ellipseMode(CENTER);
rectMode(CENTER);

// Body
stroke(0);
fill(150);
rect(200,200,75,100);

// Head
fill(155);
rect(200,100,60,60);

// Neck
fill(160);
ellipse(200,140,25,20);

// Eyes
fill(255);
ellipse(185,100,16,25);
ellipse(215,100,16,25);
fill(0);
ellipse(185,105,10,12);
ellipse(215,105,10,12);

//Mouth
line(190,120,210,120);

// Antennae
stroke(0);
line(190,70,180,50);
line(220,50,210,70);

//TV box belly
fill(255);
rect(200,205,35,65);

//Feet
fill(160);
rect(180,263,25,25);
rect(220,263,25,25);
ellipse(180,288,21,21);
ellipse(220,288,21,21);
rect(180,312,25,25);
rect(220,312,25,25);
ellipse(178,330,40,15);
ellipse(222,330,40,15);

//Arms
fill(255);
ellipse(160,165,21,21);
ellipse(240,165,21,21);
fill(160);
rect(165,165,25,25);
rect(235,165,25,25);

Leave a Reply