Getting Started with Processing

I’m happy to announce the publication of my latest book written with Ben:

Getting Started with Processing
Casey Reas, Ben Fry
O’Reilly Media / Make
Print ISBN  978-1-4493-7980-3
Ebook ISBN  978-1-4493-7981-0
5.5 x 8.5 inches
Paperback, 208 pages

This slim volume was written as a softer introduction to programming than our book with MIT Press, Processing: A Programming Handbook for Visual Designers and Artists. In contrast, it’s more casual and affordable and focuses specifically on Processing. At the request of the O’Reilly, we answered a series of questions to help them promote the book. I think they are the most concise way to explain why we wrote the book:

What made you write the book?

To make learning computer programming easier and more enjoyable. This book is for a different audience than the overwhelming majority of programming books. We promote a different approach that emphasizes making and doing and creativity. We introduce programming by emphasizing image making, rather than manipulating numbers and text.

Why is your book especially important now?

Software is one of the most important forces defining our future: culturally, socially, politically. We focus on the cultural component. This book integrates learning how to program with the visual arts. The promotion quotes on the inside front cover of the books sums this up, particularly the quote from John Maeda:

“Making a computer program used to be as easy as turning it on and typing one or two lines of code to get it to say, ‘Hello.’ Now it takes a 500+-page manual and an entire village. Not anymore. This little book by Ben and Casey gets you computationally drawing lines, triangles, and circles within minutes of clicking the ‘download’ button. They’ve made making computer programs humanly and humanely possible again — and that’s no small feat.”
John Maeda, President of Rhode Island School of Design

What is the single most important thing readers of your book will be able to do after reading your book

To write their own programs. This changes the relationship between an individual to her computer. She is now a creator, producer, and maker. She starts to become literate in a new way.

Who is your intended audience?

This book is for the hobbyists, tinkerers, and makers, but about it’s about software, rather and electronics and construction. It assumes no prior knowledge of programming, but it does assume a basic understanding of using computers and graphics software for drawing. The audience ranges from children to hobbyists to professionals – people interested in getting started programming through making images. It’s a perfect book for workshops because it covers the basics quickly and is inexpensive. It’s a gift for the children, nephews, and nieces of programers. It’s for people who loved Logo as a child and want to pass on that experience to the next generation.

How important is the subject matter of your book? What do you think is on the horizon for your readers?

This book is a gateway to learning more about programming. It’s intended to get people excited. It can be followed with a number of other books and classes.

Getting Started with Processing related to other O’Reilly titles:

Visualizing Data by Ben Fry
Programming Interactivity by Joshua Noble
Making Things Talk by Tom Igoe
Getting Started with Arduino by Massimo Banzi

Could you send us a list of 5-10 tips, tricks, and/or best practices?

We’ve compiled five short programs from Getting Started with Processing. Download the Processing software from http://processing.org or run them online at http://sketch.processing.org. Cut and paste one program at time into the text box and press the play button to run.

Example 3-17: Draw with Transparency

size(600, 400);
noStroke();
smooth();
background(204, 226, 225);     // Light blue color
fill(255, 0, 0, 160);          // Red color
ellipse(232, 182, 400, 400);   // Red circle
fill(0, 255, 0, 160);          // Green color
ellipse(328, 84, 400, 400);    // Green circle
fill(0, 0, 255, 160);          // Blue color
ellipse(368, 218, 400, 400);   // Blue circle

Example 4-12: Pins and Lines

size(600, 400);
background(0);
smooth();
fill(255);
stroke(102);
for (int y = 20; y <= height-20; y += 10) {
  for (int x = 20; x <= width-20; x += 10) {
    ellipse(x, y, 4, 4);
    // Draw a line to the center of the display
    line(x, y, 300, 200);
  }
}

Example 5-9: Smooth Lines with Easing

float x;
float y;
float px;
float py;
float easing = 0.05;

void setup() {
  size(600, 400);
  smooth();
  stroke(0, 102);
}

void draw() {
  float targetX = mouseX;
  x += (targetX - x) * easing;
  float targetY = mouseY;
  y += (targetY - y) * easing;
  float weight = dist(x, y, px, py);
  strokeWeight(weight);
  line(x, y, px, py);
  py = y;
  px = x;
}

Example 7-9: Move Shapes Randomly

float speed = 2.5;
int diameter = 60;
float x;
float y;

void setup() {
  size(600, 400);
  smooth();
  x = width/2;
  y = height/2;
}

void draw() {
  x += random(-speed, speed);
  y += random(-speed, speed);
  ellipse(x, y, diameter, diameter);
}

Example 10-9: Track Mouse Movements

int num = 60;
int x[] = new int[num];
int y[] = new int[num];

void setup() {
  size(600, 400);
  smooth();
  noStroke();
}

void draw() {
  background(0);
  // Copy array values from back to front
  for (int i = x.length-1; i > 0; i--) {
    x[i] = x[i-1];
    y[i] = y[i-1];
  }
  x[0] = mouseX; // Set the first element
  y[0] = mouseY; // Set the first element
  for (int i = 0; i < x.length; i++) {
    fill(i * 4);
    ellipse(x[i], y[i], 40, 40);
  }
}

This is just the beginning, Getting Started with Processing has over 120 example programs.

Comments are closed.