You are previewing Make: Getting Started with Processing, 2nd Edition.
O'Reilly logo
Make: Getting Started with Processing, 2nd Edition

Book Description

Processing opened up the world of programming to artists, designers, educators, and beginners. This short book gently introduces the core concepts of computer programming and working with Processing. Written by the co-founders of the Processing project, Reas and Fry, Getting Started with Processing shows you how easy it is to make software and systems with interactive graphics. If you're an artist looking to develop interactive graphics programs or a programmer on your way to becoming an artist, this book will take you where you want to go. Updated with new material on graphics manipulation, data, and for the latest version of Processing.

Table of Contents

  1. Preface
    1. How This Book Is Organized
    2. Who This Book Is For
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Safari® Books Online
    6. How to Contact Us
    7. Acknowledgments
  2. 1. Hello
    1. Sketching and Prototyping
    2. Flexibility
    3. Giants
    4. Family Tree
    5. Join In
  3. 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 and New
    4. Share
    5. Examples and Reference
  4. 3. Draw
    1. The Display Window
      1. Example 3-1: Draw a Window
      2. Example 3-2: Draw a Point
    2. 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
    3. Drawing Order
      1. Example 3-9: Control Your Drawing Order
      2. Example 3-10: Put It in Reverse
    4. Shape Properties
      1. Example 3-11: Set Stroke Weight
      2. Example 3-12: Set Stroke Caps
      3. Example 3-13: Set Stroke Joins
    5. Drawing Modes
      1. Example 3-14: On the Corner
    6. Color
      1. Example 3-15: Paint with Grays
      2. Example 3-16: Control Fill and Stroke
      3. Example 3-17: Draw with Color
      4. Example 3-18: Set Transparency
    7. Custom Shapes
      1. Example 3-19: Draw an Arrow
      2. Example 3-20: Close the Gap
      3. Example 3-21: Create Some Creatures
    8. Comments
    9. Robot 1: Draw
  5. 4. Variables
    1. First Variables
      1. Example 4-1: Reuse the Same Values
      2. Example 4-2: Change Values
    2. Making Variables
    3. Processing Variables
      1. Example 4-3: Adjust the Size, See What Follows
    4. A Little Math
      1. Example 4-4: Basic Arithmetic
    5. 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
    6. Robot 2: Variables
  6. 5. Response
    1. Once and Forever
      1. Example 5-1: The draw() Function
      2. Example 5-2: The setup() Function
      3. Example 5-3: Global Variable
    2. 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 Line Thickness
      5. Example 5-8: Easing Does It
      6. Example 5-9: Smooth Lines with Easing
    3. Click
      1. Example 5-10: Click the Mouse
      2. Example 5-11: Detect When Not Clicked
      3. Example 5-12: Multiple Mouse Buttons
    4. Location
      1. Example 5-13: Find the Cursor
      2. Example 5-14: The Bounds of a Circle
      3. Example 5-15: The Bounds of a Rectangle
    5. Type
      1. Example 5-16: Tap a Key
      2. Example 5-17: Draw Some Letters
      3. Example 5-18: Check for Specific Keys
      4. Example 5-19: Move with Arrow Keys
    6. Map
      1. Example 5-20: Map Values to a Range
      2. Example 5-21: Map with the map() Function
    7. Robot 3: Response
  7. 6. Translate, Rotate, Scale
    1. Translate
      1. Example 6-1: Translating Location
      2. Example 6-2: Multiple Translations
    2. Rotate
      1. Example 6-3: Corner Rotation
      2. Example 6-4: Center Rotation
      3. Example 6-5: Translation, then Rotation
      4. Example 6-6: Rotation, Then Translation
      5. Example 6-7: An Articulating Arm
    3. Scale
      1. Example 6-8: Scaling
      2. Example 6-9: Keeping Strokes Consistent
    4. Push and Pop
      1. Example 6-10: Isolating Transformations
    5. Robot 4: Translate, Rotate, Scale
  8. 7. Media
    1. Images
      1. Example 7-1: Load an Image
      2. Example 7-2: Load More Images
      3. Example 7-3: Mousing Around with Images
      4. Example 7-4: Transparency with a GIF
      5. Example 7-5: Transparency with a PNG
    2. Fonts
      1. Example 7-6: Drawing with Fonts
      2. Example 7-7: Draw Text in a Box
      3. Example 7-8: Store Text in a String
    3. Shapes
      1. Example 7-9: Draw with Shapes
      2. Example 7-10: Scaling Shapes
      3. Example 7-11: Creating a New Shape
    4. Robot 5: Media
  9. 8. Motion
    1. Frames
      1. Example 8-1: See the Frame Rate
      2. Example 8-2: Set the Frame Rate
    2. Speed and Direction
      1. Example 8-3: Move a Shape
      2. Example 8-4: Wrap Around
      3. Example 8-5: Bounce Off the Wall
    3. Tweening
      1. Example 8-6: Calculate Tween Positions
    4. Random
      1. Example 8-7: Generate Random Values
      2. Example 8-8: Draw Randomly
      3. Example 8-9: Move Shapes Randomly
    5. Timers
      1. Example 8-10: Time Passes
      2. Example 8-11: Triggering Timed Events
    6. Circular
      1. Example 8-12: Sine Wave Values
      2. Example 8-13: Sine Wave Movement
      3. Example 8-14: Circular Motion
      4. Example 8-15: Spirals
    7. Robot 6: Motion
  10. 9. Functions
    1. Function Basics
      1. Example 9-1: Roll the Dice
      2. Example 9-2: Another Way to Roll
    2. Make a Function
      1. Example 9-3: Draw the Owl
      2. Example 9-4: Two’s Company
      3. Example 9-5: An Owl Function
      4. Example 9-6: Increasing the Surplus Population
      5. Example 9-7: Owls of Different Sizes
    3. Return Values
      1. Example 9-8: Return a Value
    4. Robot 7: Functions
  11. 10. Objects
    1. Fields and Methods
    2. Define a Class
    3. Create Objects
      1. Example 10-1: Make an Object
      2. Example 10-2: Make Multiple Objects
    4. Tabs
    5. Robot 8: Objects
  12. 11. Arrays
    1. From Variables to Arrays
      1. Example 11-1: Many Variables
      2. Example 11-2: Too Many Variables
      3. Example 11-3: Arrays, Not Variables
    2. Make an Array
      1. Example 11-4: Declare and Assign an Array
      2. Example 11-5: Compact Array Assignment
      3. Example 11-6: Assigning to an Array in One Go
      4. Example 11-7: Revisiting the First Example
    3. Repetition and Arrays
      1. Example 11-8: Filling an Array in a for Loop
      2. Example 11-9: Track Mouse Movements
    4. Arrays of Objects
      1. Example 11-10: Managing Many Objects
      2. Example 11-11: A New Way to Manage Objects
      3. Example 11-12: Sequences of Images
    5. Robot 9: Arrays
  13. 12. Data
    1. Data Summary
    2. Tables
      1. Example 12-1: Read the Table
      2. Example 12-2: Draw the Table
      3. Example 12-3: 29,740 Cities
    3. JSON
      1. Example 12-4: Read a JSON File
      2. Example 12-5: Visualize Data from a JSON File
    4. Network Data and APIs
      1. Example 12-6: Parsing the Weather Data
      2. Example 12-7: Chaining Methods
    5. Robot 10: Data
  14. 13. Extend
    1. Sound
      1. Example 13-1: Play a Sample
      2. Example 13-2: Listen to a Microphone
      3. Example 13-3: Create a Sine Wave
    2. Image and PDF Export
      1. Example 13-4: Saving Images
      2. Example 13-5: Draw to a PDF
    3. Hello, Arduino
      1. Example 13-6: Read a Sensor
      2. Example 13-7: Read Data from the Serial Port
      3. Example 13-8: Visualizing the Data Stream
      4. Example 13-9: Another Way to Look at the Data
  15. 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
  16. B. Data Types
  17. C. Order of Operations
  18. D. Variable Scope
  19. Index