# Getting Started with Processing: A Hands-On Introduction to Making Interactive Graphics

## Casey Reas, Ben Fry

Language: English

Pages: 238

ISBN: 1457187086

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.

background(204); if (mouseX > x) { x += 0.5; offset = -10; } if (mouseX < x) { x -= 0.5; offset = 10; } line(x, 0, x, height); line(mouseX, mouseY, mouseX + offset, mouseY - 10); line(mouseX, mouseY, mouseX + offset, mouseY + 10); line(mouseX, mouseY, mouseX + offset*3, mouseY); } To write programs that have graphical user interfaces (buttons, checkboxes, scrollbars, and so on), we need to write code that knows when the cursor is within an enclosed area of the screen. The following two examples

16; bodyHeight = 90; } else { neckHeight = 70; bodyHeight = 160; } float ny = y - bodyHeight - neckHeight - radius; background(204); // Neck stroke(102); line(x+12, y-bodyHeight, x+12, 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(102); ellipse(x, y-33, 33, 33); fill(0); rect(x-45, y-bodyHeight, 90, bodyHeight-33); // Head fill(0); ellipse(x+12, ny, radius, radius); fill(255); ellipse(x+24, ny-6, 14, 14); fill(0);

Processingâ€™s 3D coordinate system. The P3D renderer is built-in, but the OpenGL renderer is a library and requires the import statement within the code, as shown at the top of Example 11-1. The OpenGL renderer makes use of faster graphics hardware thatâ€™s available on most machines sold nowadays. NOTE: The OpenGL renderer is not guaranteed to be faster in all situations; see the size() reference for more details. Many of the functions introduced in this book have variations for working in 3D. For

problem lies. Try to think of fixing bugs as solving a mystery or puzzle. If you get stuck or frustrated, take a break to clear your head or ask a friend for help. Sometimes, the answer is right under your nose but requires a second opinion to make it clear. Appendix A 181 From library of Wow! eBook From library of Wow! eBook From library of Wow! eBook B/Data Types There are different categories of data. For instance, think about the data on an ID card. The card has numbers to store

(Figure 2-2). After exporting, the applet folder will open on your desktop. The PDE file is the source code, the JAR file is the program, the HTML file is the web page, and the GIF file is displayed in the web browser while the program is loading. Double-clicking the index.html file will launch your web browser and show your sketch on the web page it has created. Figure 2-2. The applet folder contains the exported sketch. 12 Getting Started with Processing From library of Wow! eBook NOTE: