0%

This beginners book introduces non-programmers to the fundamentals of computer coding within a visual, arts-focused context. Tristan Bunn’s remarkably effective teaching approach is designed to help you visualize core programming concepts while you make cool pictures, animations, and simulations using Python Mode for the open-source Processing development environment.

Right from the first chapter, you'll produce and manipulate colorful drawings, shapes and patterns as Bunn walks you through a series of easy-to-follow graphical coding projects that grow increasingly complex. You’ll go from drawing with code to animating a bouncing DVD screensaver and practicing data-visualization techniques. Along the way, you’ll encounter creative-yet-practical skill-building challenges that relate to everything from video games, cars, and coffee, to fine art, amoebas, and Pink Floyd. As you grow more fluent in both Python and programming in general, topics shift toward the mastery of algorithmic thinking, as you explore periodic motion, Lissajous curves, and using classes to create objects.

You’ll learn about:

•Basic coding theories and concepts, like variables, data types, pixel coordinates, control flow and algorithms
•Writing code that produces drawings, patterns, animations, data visualizations, user interfaces, and simulations
•Using conditional statements, iteration, randomness, lists and dictionaries
•Defining functions, reducing repetition, and making your code more modular
•How to write classes, and create objects to structure code more efficiently

In addition to giving you a good grounding in general programming, the skills and knowledge you’ll gain in this book are your entry point to coding for an ever-expanding horizon of creative technologies.

Table of Contents

  1. Title Page
  2. Copyright
  3. About the Author
  4. Acknowledgments
  5. Introduction
    1. Who Is This Book For?
    2. What Is Python Mode for Processing?
    3. What Are Algorithms?
    4. What Is Creative Coding?
    5. Where Can I Find Help?
    6. Online Resources
    7. Source Code and Solutions
    8. What’s in This Book?
    9. Let’s Go!
  6. Chapter 1: Hello, World!
    1. Processing Installation and Python Mode Setup
    2. Your First Sketch
    3. Comments
    4. Whitespace
    5. Errors
    6. Color
    7. Fills and Strokes
    8. Background Color
    9. Color Modes
    10. 2D Primitives
    11. triangle()
    12. ellipse()
    13. quad()
    14. line()
    15. Variables
    16. Arithmetic Operators
    17. Basic Operations
    18. Modulo Operator
    19. Arcs
    20. Summary
  7. Chapter 2: Drawing More Complicated Shapes
    1. Displaying a Grid
    2. Drawing Curves Using Catmull-Rom Splines
    3. Curving Lines with curve()
    4. Changing Curves with curveTightness()
    5. Drawing Bézier Curves
    6. Using the bezier() Function
    7. Positioning Anchor and Control Points
    8. Drawing Shapes Using Vertices
    9. Bézier Vertices
    10. Using Vector Graphics Software for Generating Shapes
    11. Summary
  8. Chapter 3: Introduction to Strings and Working with Text
    1. Strings
    2. Creating Strings in Python
    3. Using Concatenation and String Formatting
    4. Working with String Length
    5. String Manipulation
    6. Slice Notation
    7. String Methods
    8. Typography
    9. Fonts
    10. Text Functions
    11. Summary
  9. Chapter 4: Conditional Statements
    1. Control Flow
    2. Conditional Statements
    3. The Boolean Data Type
    4. Relational Operators
    5. if Statements
    6. elif Statements
    7. else Statements
    8. Logical Operators
    9. Summary
  10. Chapter 5: Iteration and Randomness
    1. Iteration
    2. Using Iteration to Draw Concentric Circles
    3. while Loops
    4. for Loops
    5. break and continue Statements
    6. Randomness
    7. random() Function
    8. Random Seed
    9. Truchet Tiles
    10. Summary
  11. Chapter 6: Motion and Transformation
    1. Perceiving Motion
    2. Adding Motion to Processing Sketches
    3. The draw() and setup() Functions
    4. Global Variables
    5. Saving Frames
    6. Transformations
    7. Processing Transformation Functions
    8. translate()
    9. rotate()
    10. scale()
    11. shearX() and shearY()
    12. pushMatrix() and popMatrix()
    13. Summary
  12. Chapter 7: Working with Lists and Reading Data
    1. Introducing Lists
    2. Creating and Accessing Lists
    3. Modifying Lists
    4. Combining Loops and Lists
    5. Drawing Shapes by Using a List of Color Values
    6. Looping with enumerate()
    7. Creating Lists of Lists
    8. Reading Data
    9. File Formats
    10. CSV
    11. Summary
  13. Chapter 8: Dictionaries and JSON
    1. Introducing Dictionaries
    2. Accessing Dictionaries
    3. Modifying Dictionaries
    4. Nesting Dictionaries and Lists
    5. Combining Loops and Dictionaries
    6. Iterating Keys
    7. Iterating Values
    8. Iterating Items
    9. Working with JSON
    10. Understanding JSON Syntax
    11. Using Web APIs
    12. Reading in JSON Data
    13. Summary
  14. Chapter 9: Functions and Periodic Motion
    1. Defining Functions
    2. Creating a Simple Speech Bubble Function
    3. Drawing Compound Shapes Using a Function
    4. Adding Arguments and Parameters
    5. Using Keyword Arguments
    6. Setting Default Values
    7. Mixing Positional and Keyword Arguments
    8. Returning Values
    9. Defining Functions for Periodic Motion
    10. Circular and Elliptical Motion
    11. Sine Waves
    12. Lissajous Curves
    13. Creating Screensaver-Like Patterns with Lissajous Curves
    14. Summary
  15. Chapter 10: Object-Oriented Programming and PVector
    1. Working with Classes
    2. Defining a New Class
    3. Creating an Instance from a Class
    4. Adding Attributes to a Class
    5. Adding Methods to a Class
    6. Splitting Your Python Code into Multiple Files
    7. Programming Movement with Vectors
    8. The PVector Class
    9. Moving an Amoeba with PVector
    10. Adding Many Amoebas to the Simulation
    11. Summary
  16. Chapter 11: Mouse and Keyboard Interaction
    1. Mouse Interaction
    2. Mouse Variables
    3. Mouse Events
    4. Creating a Paint App
    5. Keyboard Interaction
    6. Adding Keyboard Shortcuts to the Paint App
    7. Summary
  17. Afterword
    1. More Python for Processing
    2. More Python
    3. Other Creative Coding Environments
  18. Index
18.188.61.223