Dedication
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. Theyve made making computer programs humanly and humanely possible againand thats no small feat.
John Maeda, President of Rhode Island School of Design
Getting Started with Processing is not only a straightforward introduction to basic programmingits 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 its one of the major factors of the success of Arduino.
Massimo Banzi, Cofounder 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, theyre 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
Make: Getting Started with Processing
by Casey Reas and Ben Fry
Copyright 2015 Ben Fry and Casey Reas. All rights reserved.
Printed in the United States of America.
Published by Maker Media, Inc. , 1160 Battery Street East, Suite 125, San Francisco, CA 94111.
Maker Media books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com .
- Editor: Anna Kaziunas France
- Production Editor: Nicole Shelby
- Copyeditor: Jasmine Kwityn
- Proofreader: Kim Cofer
- Indexer: Wendy Catalano
- Interior Designer: David Futato
- Cover Designer: Casey Reas
- Illustrator: Rebecca Demarest
- September 2015: Second Edition
Revision History for the Second Edition
- 2015-09-03: First Release
See http://oreilly.com/catalog/errata.csp?isbn=9781457187087 for release details.
The Make logo is a registered trademark of Maker Media, Inc. Make: Getting Started with Processing, the cover image, and related trade dress are trademarks of Maker Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Maker Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps.
While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
978-1-457-18708-7
[LSI]
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 (Java and C++), 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 we were maintaining and teaching at the time (and which was created by our research advisor, John Maeda ).
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 curricula 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.)
In fall 2008, we launched the 1.0 version of the software. After seven years of work, the 1.0 launch signified stability for the language. We launched the 2.0 release in spring 2013 to make the software faster. The 2.0 releases introduced better OpenGL integration, GLSL shaders, and faster video playback with GStreamer. The 3.0 releases in 2015 make programming in Processing easier with a new interface and error checking while programming.
Now, fourteen years after its origin, Processing has grown beyond its original goals, and weve 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 youll 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 twelve years, we cant 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.