You are previewing Getting Started with Processing.
O'Reilly logo
Getting Started with Processing

Book Description

Learn computer programming the easy way with Processing, a simple language that lets you use code to create drawings, animation, and interactive graphics. Programming courses usually start with theory, but this book lets you jump right into creative and fun projects. It's ideal for anyone who wants to learn basic programming, and serves as a simple introduction to graphics for people with some programming skills.

Table of Contents

  1. Getting Started with Processing
  2. A Note Regarding Supplemental Files
  3. Advance Praise for Getting Started with Processing
  4. Preface
    1. How This Book Is Organized
    2. Who This Book Is For
    3. Conventions Used in This Book
    4. Using Code Examples
    5. How to Contact Us
    6. SafariĀ® Books Online
    7. Acknowledgments
  5. 1. Hello
    1. Sketching and Prototyping
    2. Flexibility
    3. Giants
    4. Family Tree
    5. Join In
  6. 2. Starting to Code
    1. Your First Program
      1. Example 2-1: Draw an Ellipse
      2. Example 2-2: Make Circles
    2. Show
    3. Save
    4. Share
    5. Examples and Reference
  7. 3. Draw
      1. Example 3-1: Draw a Window
      2. Example 3-2: Draw a Point
    1. Basic Shapes
      1. Example 3-3: Draw a Line
      2. Example 3-4: Draw Basic Shapes
      3. Example 3-5: Draw a Rectangle
      4. Example 3-6: Draw an Ellipse
      5. Example 3-7: Draw Part of an Ellipse
      6. Example 3-8: Draw with Degrees
    2. Drawing Order
      1. Example 3-9: Control Your Drawing Order
      2. Example 3-10: Put It in Reverse
    3. Shape Properties
      1. Example 3-11: Draw Smooth Lines
      2. Example 3-12: Set Stroke Weight
      3. Example 3-13: Set Stroke Attributes
    4. Color
      1. Example 3-14: Paint with Grays
      2. Example 3-15: Control Fill and Stroke
      3. Example 3-16: Draw with Color
      4. Example 3-17: Set Transparency
    5. Custom Shapes
      1. Example 3-18: Draw an Arrow
      2. Example 3-19: Close the Gap
      3. Example 3-20: Create Some Creatures
    6. Comments
    7. Robot 1: Draw
  8. 4. Variables
      1. Example 4-1: Reuse the Same Values
      2. Example 4-2: Change Values
    1. Making Variables
    2. Processing Variables
      1. Example 4-3: Adjust the Size, See What Follows
    3. A Little Math
      1. Example 4-4: Basic Arithmetic
    4. Repetition
      1. Example 4-5: Do the Same Thing Over and Over
      2. Example 4-6: Use a for Loop
      3. Example 4-7: Flex Your for Loop's Muscles
      4. Example 4-8: Fanning Out the Lines
      5. Example 4-9: Kinking the Lines
      6. Example 4-10: Embed One for Loop in Another
      7. Example 4-11: Rows and Columns
      8. Example 4-12: Pins and Lines
      9. Example 4-13: Halftone Dots
    5. Robot 2: Variables
  9. 5. Response
      1. Example 5-1: The draw() Function
      2. Example 5-2: The setup() Function
      3. Example 5-3: setup(), Meet draw()
    1. Follow
      1. Example 5-4: Track the Mouse
      2. Example 5-5: The Dot Follows You
      3. Example 5-6: Draw Continuously
      4. Example 5-7: Set Thickness on the Fly
      5. Example 5-8: Easing Does It
      6. Example 5-9: Smooth Lines with Easing
    2. Map
      1. Example 5-10: Map Values to a Range
      2. Example 5-11: Map with the map() Function
    3. Click
      1. Example 5-12: Click the Mouse
      2. Example 5-13: Detect When Not Clicked
      3. Example 5-14: Multiple Mouse Buttons
    4. Location
      1. Example 5-15: Find the Cursor
      2. Example 5-16: The Bounds of a Circle
      3. Example 5-17: The Bounds of a Rectangle
    5. Type
      1. Example 5-18: Tap a Key
      2. Example 5-19: Draw Some Letters
      3. Example 5-20: Check for Specific Keys
      4. Example 5-21: Move with Arrow Keys
    6. Robot 3: Response
  10. 6. Media
    1. Images
      1. Example 6-1: Load an Image
      2. Example 6-2: Load More Images
      3. Example 6-3: Mousing Around with Images
      4. Example 6-4: Transparency with a GIF
      5. Example 6-5: Transparency with a PNG
    2. Fonts
      1. Example 6-6: Drawing with Fonts
      2. Example 6-7: Draw Text in a Box
      3. Example 6-8: Store Text in a String
    3. Shapes
      1. Example 6-9: Draw with Shapes
      2. Example 6-10: Scaling Shapes
    4. Robot 4: Media
  11. 7. Motion
      1. Example 7-1: See the Frame Rate
      2. Example 7-2: Set the Frame Rate
    1. Speed and Direction
      1. Example 7-3: Move a Shape
      2. Example 7-4: Wrap Around
      3. Example 7-5: Bounce Off the Wall
    2. Tweening
      1. Example 7-6: Calculate Tween Positions
    3. Random
      1. Example 7-7: Generate Random Values
      2. Example 7-8: Draw Randomly
      3. Example 7-9: Move Shapes Randomly
    4. Timers
      1. Example 7-10: Time Passes
      2. Example 7-11: Triggering Timed Events
    5. Circular
      1. Example 7-12: Sine Wave Values
      2. Example 7-13: Sine Wave Movement
      3. Example 7-14: Circular Motion
      4. Example 7-15: Spirals
    6. Translate, Rotate, Scale
      1. Example 7-16: Translating Location
      2. Example 7-17: Multiple Translations
      3. Example 7-18: Isolating Transformations
      4. Example 7-19: Rotation
      5. Example 7-20: Combining Transformations
      6. Example 7-21: Scaling
      7. Example 7-22: Keeping Strokes Consistent
      8. Example 7-23: An Articulating Arm
    7. Robot 5: Motion
  12. 8. Functions
    1. Function Basics
      1. Example 8-1: Roll the Dice
      2. Example 8-2: Another Way to Roll
    2. Make a Function
      1. Example 8-3: Draw the Owl
      2. Example 8-4: Two's Company
      3. Example 8-5: An Owl Function
      4. Example 8-6: Increasing the Surplus Population
      5. Example 8-7: Owls of Different Sizes
    3. Return Values
      1. Example 8-8: Return a Value
    4. Robot 6: Functions
  13. 9. Objects
    1. Classes and Objects
      1. Define a Class
      2. Example 9-1: Make an Object
      3. Example 9-2: Making Multiple Objects
    2. Robot 7: Objects
  14. 10. Arrays
      1. Example 10-1: Many Variables
      2. Example 10-2: Too Many Variables
      3. Example 10-3: Arrays, Not Variables
    1. Make an Array
      1. Example 10-4: Declare and Assign an Array
      2. Example 10-5: Compact Array Assignment
      3. Example 10-6: Assigning to an Array in One Go
      4. Example 10-7: Revisiting the First Example
    2. Repetition and Arrays
      1. Example 10-8: Filling an Array in a for Loop
      2. Example 10-9: Track Mouse Movements
    3. Arrays of Objects
      1. Example 10-10: Managing Many Objects
      2. Example 10-11: Sequences of Images
    4. Robot 8: Arrays
  15. 11. Extend
    1. 3D
      1. Example 11-1: A 3D Demo
      2. Example 11-2: Lighting
      3. Example 11-3: The Processing Camera
    2. Image Export
      1. Example 11-4: Saving Images
      2. Example 11-5: Draw to a PDF
    3. Hello Arduino
      1. Example 11-6: Read a Sensor
      2. Example 11-7: Read Data from the Serial Port
      3. Example 11-8: Visualizing the Data Stream
      4. Example 11-9: Another Way to Look at the Data
    4. Community
  16. A. Coding Tips
    1. Functions and Parameters
    2. Color Coding
    3. Comments
    4. Uppercase and Lowercase
    5. Style
    6. Console
    7. One Step at a Time
  17. B. Data Types
  18. C. Order of Operations
  19. D. Variable Scope
  20. Index
  21. About the Authors
  22. Colophon
  23. Copyright