100 Cool Processing Sketches
100 Cool Processing Sketches

Retired

This book is no longer available for sale.

100 Cool Processing Sketches

About the Book

This book begins by describing some very simple projects (draw circles and lines) and by explaining how the language works. Each sketch is a little more complex than the one before, and all are based on creating something visually or auditorially interesting. Use the book for fun, or to teach artists, new media students, and even intro programmers.

About the Author

Jim Parker
Jim Parker

Jim Parker is a Professor of Art at a major Canadian University, having spent many years previous as a computer science professor. He is an expert in computer vision and image processing, computer simulation, and most recently has focussed on game design and generative art. This book is Jim's seventh. His home page is www.ucalgary.ca/~jparker

He is also a principal of Minkhollow Media, a small company in Cochrane, Alberta that builds educational software and experiences. www.minkhollow.ca

Table of Contents

Introduction to Processing ……………………………………………………………..          4

Sketch 1: Draw a circle  ………………………………………..………………………..          8

Sketch 2: Colors  ………………………………………………………………………….        10

Sketch 3: Conditions - IF Statements  ……………………………………………......      12

Sketch 4: Loops - FOR statements and Looping N Times  ……………………………    14

Sketch 5:  Lines   ………………………………………………..……………….……….        16

Sketch 6: Arrays - Collections of Variables  …………………………………………..     18

Sketch 7: Lines  Again. And Arrays …………………………………………………….     20

Sketch 8: Draw Filled Circles at Random Locations ……………………………….…     22

Sketch 9: Draw a Rectangle, rubber band sizing  …………………………………....     24

Sketch 10: Triangles. And Motion  ………………………………………………….….       26

Sketch 11: Text I  …………………………………………………………………………       28

Sketch 12: Strings - Collections of Characters  ………………………………..……..     30

Sketch 13: Load and Display an image  …………………………………………..…..      32

Sketch 14: Images - Theory and Practice  …………………………………………...     34

Sketch 15: Manipulating Images I - Aspect Ratio  ………………......................     36

Sketch 16: Manipulating Images II – Cropping  ……………………….…………...     38

Sketch 17: Manipulating Images III – Magnifier  ……………………………...…..     40

Sketch 18: Rotation  ………………………………………………………………..….        42

Sketch 19: Rotation About Any Point – Translation  ……………....……………….    44

Sketch 20: Rotation of an Image  ……………………………………………………       46

Sketch 21: Get the Value of a Pixel  ……………………………………………..…..      48

Sketch 22: Set and Change the Value of Pixels  …………………………………….     50

Sketch 23: Change the Value of Pixels – Thresholding  ………..…..……………..     52

Sketch 24: User Defined Functions  …………………………………………..……..       54

Sketch 25: Elements of Programming Style …………………………………….….      56

Sketch 26: Duplicating Images – More Functions ………………….………………      58

Sketch 27: Saving an Image – and Transparency  ……………….…………………     60

Sketch 28: Bounce an Object in a Window  …………………………….…………….     62

Sketch 29: Basic Sprite Graphics  ……………………………………………….…….      64

Sketch 30: Object-Object Collisions  ………………………………………….…….       66

Sketch 31: Animation - Synthetic TV Static  …………………………………….….     68

Sketch 32: Frame Animation  ………………………………………….…………….       70

Sketch 33: Fonts, Sizes, and Font Properties  ……………………………………..     72

Sketch 34: Scrolling Text  …………………………………..…………………………      74

Sketch 35: Text Animation  …………………………………………………………..      76

Sketch 36: Text - Input a File Name  ...………………………..……………………      78

Sketch 37: Text: Input an Integer  …………………………………………….……      80

Sketch 38: Reading Parameters from a File  ……………………………………....     82

Sketch 39: Writing Text to a File  …………………………………………………….      84

Sketch 40: Simulated Computer Screen  …………………………………………….     86

Sketch 41: A Button  ………………………………….……………………………….       88

Sketch 42: Multiple Buttons – The Class Object  …………………………………..     90

Sketch 43: Slider  ………………………………………………………………..…….       92

Sketch 44: Gauge Display  ……………………………………………………..…….       94

Sketch 45: Likert Scale ……………………………………………………………….       96

Sketch 46: Thermometer  ……………………………………………………..……..      98

Sketch 47: Filling Complex Shapes – Flood Fill  …………………………………..     100

Sketch 48: Open a Web Page  ………………………………………………..…….      102

Sketch 49: Display Images From a Web page  ………………….……………….     104

Sketch 50: Client/Server Communication   …………………………………….…     106

Sketch 51: Basic 3D Objects …………………………………….…………………       108

Sketch 52: 3D Geometry – Viewpoints, Projections  ……..……………………..    110

Sketch 53: 3D Illumination  …………………………………………………….…..      112

Sketch 54: 3D Position & Viewpoint – 3D Bouncing Ball  …....…………………    114

Sketch 55: Constructing 3D Objects Using Planes  ………………………………    116

Sketch 56: Texture Mapping  ……………………………………………..………..      118

Sketch 57: A Tree – Billboards  …………………………………………..………..      120

Sketch 58: Moving the Viewpoint in 3D  ………………………………….……….     122

Sketch 59: Flashlight …………………………………………….………………….       124

Sketch 60: Driving  ………………………………………………………………….        126

Sketch 61: Graphic Objects – Layers  …………………………………………….      128

Sketch 62: Seeing the World through a Window  ………..……………………….   130

Sketch 63: A Rotating Planet – Pshape  …………………………………….……     132

Sketch 64: Curves (Splines)  …………………………………………………..….       134

Sketch 65: Waypoints – Driving II  ………………………………………….…..      136

Sketch 66: Lots of Small Objects – A Snowstorm  ………………..…………….    138

Sketch 67: Particle Graphics – Smoke  …………………………………………..     140

Sketch 68: A Spinning Propeller – Saving a State  ……………………..……….   142

Sketch 69: L-Systems – Drawing Plants  ……………………………………..…     144

Sketch 70: Image Warping  ………………………………….……………………      146

Sketch 71: Minim Sound Display  ……………………………………………..…..     148

Sketch 72: Sound Display with Volume Bars  ……………………………………    150

Sketch 73: Sound Effect – Impact  …………………………………………….….    152

Sketch 74: Mix Two Sounds  ……………………………………………………….      154

Sketch 75: Display Audio Waveform – Visualization  ……………..…………..   156

Sketch 76: Sound Controlling a Graphic – Visualization II  ………………..…..  158

Sketch 77: Positional Sound  …………………………………………………..….     160

Sketch 78: Synthetic Sounds  ……………………………………………..………     162

Sketch 79: Recording Sound – And Saving It!  …………………………...……..   164

Sketch 80: Playing a Video   ………………………………..……………………..     166

Sketch 81: Playing a Video – Jog/Shuttle  ………………………………………    168

Sketch 82: Saving Still Frames from a Video  ……………………..…………….   170

Sketch 83: Video Process and Display  ……………..…………………………...    172

Sketch 84: Capture from a Webcam  …………………………….………………    174

Sketch 85: Mapping Live Video as a Texture  ………….…………………………   176

Sketch 86: Time – A Clock  ……………………………………………….………..     178

Sketch 87: Time Differences - Reaction Time Tester  ………………….………   180

Sketch 88: Time in Simulations - M/M/1 Queue  ……………..…………………   182

Sketch 89: Predator-Prey Simulation  …………………………………….…….    184

Sketch 90: Flocking Behavior  …………………………………………..………..     186

Sketch 91: Simulating the Aurora  …………………………………………….….    188

Sketch 92: A Dynamic Advertisement  ……………………………………..…..     190

Sketch 93: Nim  ……………………………………………………………………..      192

Sketch 94: Pathfinding   ……………………………………………………………     194

Sketch 95: A Lava Lamp – MetaBalls  ………………………………………..…..    196

Sketch 96: A Robot Arm  …………………………………………………………..     198

Sketch 97: Lightning  ………………………………….……………………………     200

Sketch 98: Breakout  ……………………………………………….………………     202

Sketch 99: Terrain/Landscape – Midpoint Displacement  …….……………….  204

Sketch 100: Processing on the Web  …………………………………….……….   206

Supplementary Information for Each Sketch 

            Sketch 1-53  ……………………………………….……………………….       209

            Sketch 54- 85…………………………………………….…………………       229

            Sketch 86-100  ……………………………………………………..………      240

Authors have earned$8,253,093writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. Free App. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets), MOBI (for Kindle) and in the free Leanpub App (for Mac, Windows, iOS and Android). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub