SPECIAL OFFER: Upgrade this ebook with OReilly
for more information on this offer!
Please note that upgrade offers are not available from sample content.
A Note Regarding Supplemental Files
Supplemental files and examples for this book can be found at http://examples.oreilly.com/0636920000570/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Advance Praise for Getting Started with Processing
"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 againand that's no small feat."
John Maeda, President of Rhode Island School of Design
" Getting Started with Processing is not only a straightforward introduction to basic programmingit's fun! It almost feels like an activity workbook for grownups. You may want to buy it even if you never thought you were interested in programming, because you will be."
Mark Allen, Founder and Director, Machine Project
"This is an excellent primer for those wanting to dip their feet into programming graphics. Its learning by doing approach makes it particularly appropriate for artists and designers who are often put off by more traditional theory first approaches. The price of the book and the fact that the Processing environment is open source makes this an excellent choice for students."
Gillian Crampton Smith, Fondazione Venezia Professor of Design, IUAV University of Venice
"Processing changed dramatically the way we teach programming and it's one of the major factors of the success of Arduino."
"Casey Reas and Ben Fry champion the exciting power of programming for creatives in Getting Started with Processing , a hands-on guide for making code-based drawings and interactive graphics. Reas and Fry are clear and direct, but as artists, they're not afraid to be a bit eccentric and offbeat. This makes their unique form of teaching powerful."
Holly Willis, Director of Academic Programs, Institute for Multimedia Literacy, School of Cinematic Arts, USC
Preface
We created Processing to make programming interactive graphics easier. We were frustrated with how difficult it was to write this type of software with the programming languages we usually used (C++ and Java) and were inspired by how simple it was to write interesting programs with the languages of our childhood (Logo and BASIC). We were most influenced by Design By Numbers (DBN), a language created by our research advisor, John Maeda, which we were maintaining and teaching at the time.
Processing was born in spring 2001 as a brainstorming session on a sheet of paper. Our goal was to make a way to sketch (prototype) the type of software we were working on, which was almost always full-screen and interactive. We were searching for a better way to test our ideas easily in code, rather than just talking about them or spending too much time programming them in C++. Our other goal was to make a language for teaching design and art students how to program and to give more technical students an easier way to work with graphics. The combination is a positive departure from the way programming is usually taught. We begin by focusing on graphics and interaction rather than on data structures and text console output.
Processing experienced a long childhood; it was alpha software from August 2002 to April 2005 and then public beta software until November 2008. During this time, it was used continuously in classrooms and by thousands of people around the world. The language, software environment, and pedagogy around the project were revised continuously during this time. Many of our original decisions about the language were reinforced and many were changed. We developed a system of software extensions, called libraries , that have allowed people to expand Processing into many unforeseen and amazing directions. (There are now over 100 libraries.) On November 29, 2008, we launched the 1.0 version of the software. After seven years of work, the 1.0 launch signified stability for the language.
Now, nine years after its origin, Processing has grown beyond its original goals, and we've learned how it can be useful in other contexts. Accordingly, this book is written for a new audiencecasual programmers, hobbyists, and anyone who wants to explore what Processing can do without getting lost in the details of a huge textbook. We hope you'll have fun and be inspired to continue programming. This book is just the start.
While we (Casey and Ben) have been guiding the Processing ship through the waters for the last nine years, we can't overstate that Processing is a community effort. From writing libraries that extend the software to posting code online and helping others learn, the community of people who use Processing has pushed it far beyond its initial conception. Without this group effort, Processing would not be what it is today.
How This Book Is Organized
The chapters in this book are organized as follows:
: Learn about Processing.
: Create your first Processing program.
: Define and draw simple shapes.
: Store, modify, and reuse data.
: Control and influence programs with the mouse and the keyboard.
: Load and display media including images, fonts, and vector files.
: Move and choreograph shapes.
: Build new code modules.
: Create code modules that combine variables and functions.
: Simplify working with lists of variables.
: Learn about 3D, image export, and reading data from an Arduino board.
Who This Book Is For
This book is written for people who want a casual and concise introduction to computer programming, who want to create images and simple interactive programs. It's for people who want a jump start on understanding the thousands of free Processing code examples and reference materials available online. Getting Started with Processing is not a programming textbook; as the title suggests, it will get you started. It's for teenagers, hobbyists, grandparents, and everyone in between.
This book is also appropriate for people with programming experience who want to learn the basics of interactive computer graphics. Getting Started with Processing contains techniques that can be applied to creating games, animation, and interfaces.
Conventions Used in This Book
The following typographical conventions are used in this book: