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