Inside you’ll learn: GREENBERG • The fundamentals of creative computer programming—from procedural IRA GREENBERG programming, to object-oriented programming, to pure Java™ programming • How to virtually draw, paint, and sculpt using computer code and clearly explained mathematical concepts PRO • 2D and 3D programming techniques, motion design, and cool graphics effects • How to code your own pixel-level imaging effects, such as image contrast, color saturation, custom gradients and more CREatE CODE • Advanced animation techniques, including realistic physics and artificial life simulation ART, VISUALIZatiONS, AND INTERACTIVE APPLicatiONS WITH THIS Foreword by Keith Peters POWERFUL YET SIMPLE If you’re interested in creating cutting-edge code-based art and animations, COMPUTER LANGUAGE you’ve come to the right place! Processing (available at http://processing.org) is a AND PROGRAMMING revolutionary open source programming language and environment designed ENVIRONMENT. to bridge the gap between programming and art, allowing non-programmers to learn programming fundamentals as easily as possible, and empowering C anyone to produce beautiful creations using math patterns. With the software freely available, Processing provides an accessible alternative to using LEARN HOW TO Flash for creative coding and computational art—both on and off ESS CODE 2D AND 3D the Web. ANIMatiON, PIXEL- This book is written especially for artists, designers, and other cre- LEVEL IMAGING, MOTION ative professionals and students exploring code art, graphics pro- EFFECTS, AND PHYSICS gramming, and computational aesthetics. The book provides a solid SIMULatiONS. and comprehensive foundation in programming, including object-orient- ed principles, and introduces you to the easy-to-grasp Processing language, so no previous coding experience is necessary. The book then goes through using Processing to code lines, curves, shapes, and motion, continuing to the point where you’ll have mastered I Processing and can really start to unleash your creativity with NG realistic physics, interactivity, and 3D! In the final chapter, you’ll Processing even learn how to extend your Processing skills by working directly with the powerful Java™ programming language—the language Processing itself is built with. Creative Coding and Computational Art ISBN-13: 978-1-59059-617-3 SHELVING CATEGORY ISBN-10: 1-59059-617-X 1. GRAPHICS PROGRAMMING 9 0 0 0 0 TAKE A CREatiVE Mac/PC compatible AND FUN APPROACH www.friendsofed.com TO LEARNING CREatiVE COMPUTER 9 781590 596173 PROGRAMMING. this print for reference only—size & color not accurate 7.5" x 9" / Casebound / Malloy spine bulk = 1.5625" 840 page count 50# Thor 617xFM.qxd 5/2/07 12:05 PM Page i Processing Creative Coding and Computational Art Ira Greenberg 617xFM.qxd 5/2/07 12:05 PM Page ii Processing: Creative Coding and Computational Art Copyright © 2007 by Ira Greenberg All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13: 978-1-59059-617-3 ISBN-10: 1-59059-617-X Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit www.springeronline.com. For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit www.apress.com. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is freely available to readers at www.friendsofed.com in the Downloads section. Credits Lead Editor Assistant Production Director Chris Mills Kari Brooks-Copony Technical Editor Production Editor Charles E. Brown Ellie Fountain Technical Reviewers Compositor Carole Katz, Mark Napier Dina Quan Editorial Board Artist Steve Anglin, Ewan Buckingham, Gary Cornell, Milne Design Services, LLC Jason Gilmore, Jonathan Gennick, Jonathan Hassell, James Huddleston, Chris Mills, Matthew Moodie, Proofreaders Jeff Pepper, Dominic Shakeshaft, Matt Wade Linda Seifert and Nancy Sixsmith Project Manager Indexer Sofia Marchant John Collin Copy Edit Manager Interior and Cover Designer Nicole Flores Kurt Krames Copy Editor Manufacturing Director Damon Larson Tom Debolski 617xFM.qxd 5/2/07 12:05 PM Page iii To Robin, Ian, and Sophie. 617xFM.qxd 5/2/07 12:05 PM Page iv CONTENTS AT A GLANCE Foreword . xv About the Author . xvii About the Tech Reviewers . xviii Acknowledgments . xix Introduction . xx PART ONE: THEORY OF PROCESSING AND COMPUTATIONAL ART . 1 Chapter 1: Code Art . 3 Chapter 2: Creative Coding . 27 Chapter 3: Code Grammar 101. 57 Chapter 4: Computer Graphics, the Fun, Easy Way . 107 Chapter 5: The Processing Environment . 143 617xFM.qxd 5/2/07 12:05 PM Page v PART TWO: PUTTING THEORY INTO PRACTICE . 171 Chapter 6: Lines . 173 Chapter 7: Curves. 241 Chapter 8: Object-Oriented Programming . 301 Chapter 9: Shapes . 339 Chapter 10: Color and Imaging. 399 Chapter 11: Motion . 481 Chapter 12: Interactivity . 563 Chapter 13: 3D . 615 PART THREE: REFERENCE . 673 Appendix A: Processing Language API . 675 Appendix B: Math Reference . 747 Index . 775 617xFM.qxd 5/2/07 12:05 PM Page vi CONTENTS Foreword . xv About the Author . xvii About the Tech Reviewers . xviii Acknowledgments . xix Introduction . xx PART ONE: THEORY OF PROCESSING AND COMPUTATIONAL ART . 1 Chapter 1: Code Art . 3 Aesthetics + Computation . 5 Computer art history . 8 Code artists. 14 Ben Laposky, 1914–2000 . 14 John Whitney Sr., 1918–1995. 15 Herbert W. Franke, b.1927 . 15 Lillian Schwartz, b. 1927 . 15 Harold Cohen, b. 1928 . 16 Roman Verostko, b. 1929. 17 George Legrady, b. 1950 . 18 Mark Napier, b. 1961 . 18 John F. Simon Jr., b. 1963 . 19 John Maeda, b. 1966 . 19 Mary Flanagan, b. 1969 . 20 Casey Reas, b. 1970 . 21 Jared Tarbell, b. 1973 . 21 Ben Fry, b. 1975 . 22 And many more . 23 Summary . 24 617xFM.qxd 5/2/07 12:05 PM Page vii CONTENTS Chapter 2: Creative Coding . 27 The origin of Processing . 30 Programming language comparisons . 31 Function-based (procedural) vs. object-oriented structure . 32 Java . 36 Procedural OOP (“poop”) approach . 39 Algorithms aren’t as scary as they sound . 40 Happy coding mistakes . 44 Algorithmic tree . 45 Summary . 54 Chapter 3: Code Grammar 101. 57 Structure and abstraction. 58 Your first program . 59 Curly braces . 61 Dot syntax . 62 Naming conventions . 63 Literals . 64 Variables . 65 Strict typing . 66 Operators. 72 Relational operators . ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages841 Page
-
File Size-