Learning Processing
eBook - ePub

Learning Processing

A Beginner's Guide to Programming Images, Animation, and Interaction

  1. 564 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Learning Processing

A Beginner's Guide to Programming Images, Animation, and Interaction

About this book

Learning Processing, Second Edition, is a friendly start-up guide to Processing, a free, open-source alternative to expensive software and daunting programming languages. Requiring no previous experience, this book is for the true programming beginner. It teaches the basic building blocks of programming needed to create cutting-edge graphics applications including interactive art, live video processing, and data visualization. Step-by-step examples, thorough explanations, hands-on exercises, and sample code, supports your learning curve.A unique lab-style manual, the book gives graphic and web designers, artists, and illustrators of all stripes a jumpstart on working with the Processing programming environment by providing instruction on the basic principles of the language, followed by careful explanations of select advanced techniques. The book has been developed with a supportive learning experience at its core. From algorithms and data mining to rendering and debugging, it teaches object-oriented programming from the ground up within the fascinating context of interactive visual media.This book is ideal for graphic designers and visual artists without programming background who want to learn programming. It will also appeal to students taking college and graduate courses in interactive media or visual computing, and for self-study.- A friendly start-up guide to Processing, a free, open-source alternative to expensive software and daunting programming languages- No previous experience required—this book is for the true programming beginner!- Step-by-step examples, thorough explanations, hands-on exercises, and sample code supports your learning curve

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Learning Processing by Daniel Shiffman in PDF and/or ePUB format, as well as other popular books in Informatica & Grafica per computer. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
Print ISBN
9780123944436
eBook ISBN
9780123947925
Lesson 1
The Beginning
1

Pixels

A journey of a thousand miles begins with a single step.
—Lao-tzu
In this chapter:
Specifying pixel coordinates
Basic shapes: point, line, rectangle, ellipse
Color: grayscale, RGB
Color: alpha transparency
Note that you are not doing any programming yet in this chapter! You are just dipping your feet in the water and getting comfortable with the idea of creating onscreen graphics with text-based commands, that is, “code”!

1-1 Graph paper

This book will teach you how to program in the context of computational media, and it will use the development environment Processing (http://www.processing.org) as the basis for all discussion and examples. But before any of this becomes relevant or interesting, you must first channel your eighth-grade self, pull out a piece of graph paper, and draw a line. The shortest distance between two points is a good old fashioned line, and this is where you will begin, with two points on that graph paper.
Figure 1-1 shows a line between point A (1,0) and point B (4,5). If you wanted to direct a friend of yours to draw that same line, you would say “draw a line from the point one-zero to the point four-five, please.” Well, for the moment, imagine your friend was a computer and you wanted to instruct this digital pal to display that same line on its screen. The same command applies (only this time you can skip the pleasantries and you will be required to employ a precise formatting). Here, the instruction will look like this:
f01-01-9780123944436
Figure 1-1
line(1, 0, 4, 5);
Congratulations, you have written your first line of computer code! I’ll will get to the precise formatting of the above later, but for now, even without knowing too much, it should make a fair amount of sense. I am providing a command (which I will refer to as a function) named line for the machine to follow. In addition, I am specifying some arguments for how that line should be drawn, from point A (1,0) to point B (4,5). If you think of that line of code as a sentence, the function is a verb and the arguments are the objects of the sentence. The code sentence also ends with a semicolon instead of a period.
u01-01-9780123944436
Figure 1-2
The key here is to realize that the computer screen is nothing more than a fancier piece of graph paper. Each pixel of the screen is a coordinate — two numbers, an x (horizontal) and a y (vertical) — that determine the location of a point in space. And it’s your job to specify what shapes and colors should appear at these pixel coordinates.
Nevertheless, there is a catch here. The graph paper from eighth grade (Cartesian coordinate system) placed (0,0) in the center with the y-axis pointing up and the x-axis pointing to the right (in the positive direction, negative down and to the left). The coordinate system for pixels in a computer window, however, is reversed along the y-axis. (0,0) can be found at the top left with the positive direction to the right horizontally and down vertically. See Figure 1-3.
f01-02-9780123944436
Figure 1-3
Exercise 1-1
Looking at how I wrote the instruction for line — line(1, 0, 4, 5); — how would you guess you would write an instruction to draw a rectangle? A circle? A triangle? Write out the instructions in English and then translate it into code.
in01-01-9780123944436
English: ___________________________
Code: ___________________________
English: ___________________________
Code: ___________________________
English: ___________________________
Code: ___________________________
Come back later and see how your guesses matched up with how Processing actually works.

1-2 Simple shapes

The vast majority of the programming examples in this book will be visual in nature. You may ultimately learn to develop interactive games, algorithmic art pieces, animated logo designs, and (insert your own category here) with Processing, but at its core, e...

Table of contents

  1. Cover image
  2. Title page
  3. Table of Contents
  4. Copyright
  5. In memoriam
  6. Acknowledgments
  7. Introduction
  8. Lesson 1: The Beginning
  9. Lesson 2: Everything You Need to Know
  10. Lesson 3: Organization
  11. Lesson 4: More of the Same
  12. Lesson 5: Putting It All Together
  13. Lesson 6: The World Revolves Around You
  14. Lesson 7: Pixels Under a Microscope
  15. Lesson 8: The Outside World
  16. Lesson 9: Making Noise
  17. Lesson 10: Beyond Processing
  18. Appendix A: Common Errors
  19. Index