Make: Getting Started with Processing: A Hands-On Introduction to Making Interactive Graphics (2nd Edition)

Make: Getting Started with Processing: A Hands-On Introduction to Making Interactive Graphics (2nd Edition)

Casey Reas, Ben Fry

Language: English

Pages: 240

ISBN: 2:00313316

Format: PDF / Kindle (mobi) / ePub


Processing opened up the world of programming to artists, designers, educators, and beginners. This short book gently introduces the core concepts of computer programming and working with Processing. Written by the co-founders of the Processing project, Reas and Fry, Getting Started with Processing shows you how easy it is to make software and systems with interactive graphics. If you're an artist looking to develop interactive graphics programs or a programmer on your way to becoming an artist, this book will take you where you want to go. Updated with new material on graphics manipulation, data, and for the latest version of Processing.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

120); vertex(100, 90); vertex(110, 60); vertex(80, 20); vertex(210, 60); Draw 29 vertex(160, 80); vertex(200, 90); vertex(140, 100); vertex(130, 120); endShape(); fill(0); ellipse(155, 60, 8, 8); // Right creature fill(176, 186, 163); beginShape(); vertex(370, 120); vertex(360, 90); vertex(290, 80); vertex(340, 70); vertex(280, 50); vertex(420, 10); vertex(390, 50); vertex(410, 90); vertex(460, 120); endShape(); fill(0); ellipse(345, 50, 10, 10); Comments The examples in this chapter use

another. The first parameter is the variable to be converted, the second and third parameters are the low and high values of that variable, and the fourth and fifth parameters are the desired low and high values. The map() function hides the math behind the conversion. Example 5-21: Map with the map() Function This example rewrites Example 5-20 on page 70 using map(): void setup() { size(240, 120); strokeWeight(12); } void draw() { background(204); stroke(102); line(mouseX, 0, mouseX, height);

ny); line(x+12, y-bodyHeight, x+12, ny); line(x+22, y-bodyHeight, x+22, ny); // Antennae line(x+12, ny, x-18, ny-43); line(x+12, ny, x+42, ny-99); line(x+12, ny, x+78, ny+15); // Body noStroke(); fill(255, 204, 0); 132 Getting Started with Processing ellipse(x, y-33, 33, 33); fill(0); rect(x-45, y-bodyHeight, 90, bodyHeight-33); fill(255, 204, 0); rect(x-45, y-bodyHeight+17, 90, 6); } // Head fill(0); ellipse(x+12, ny, radius, radius); fill(255); ellipse(x+24, ny-6, 14, 14); fill(0);

keyword, followed by the parameters into the constructor, if any: JitterBug bug = new JitterBug(200.0, 250.0, 30); The three numbers within the parentheses are the parameters that are passed into the JitterBug class constructor. The number of these parameters and their data types must match those of the constructor. Example 10-2: Make Multiple Objects In Example 10-1 on page 142, we see something else new: the period (dot) that’s used to access the object’s methods inside of draw(). The dot

the CSV notation has fewer characters, which can be important when working with massive data sets. On the other hand, the JSON version is often easier to read because each piece of data is labeled. Now that the basics of JSON and its relation to a Table has been introduced, let’s look at the code needed to read a JSON file into a Processing sketch. Example 12-4: Read a JSON File This sketch loads the JSON file seen at the beginning of this section, the file that includes only the data for the

Download sample

Download