3
A First Dynamic Sketch
In your sketches up to this point, you’ve made the decisions, and you’ve done the math. But computers are much faster than you are at both of those tasks. It’s time to set up variables, tackle some logic, and get the computer to do the heavy lifting rather than doing it yourself.
MORE ON VARIABLES
In Project 2, I showed you how to use some of Processing’s built-in variables (mouseX and mouseY) to figure out exactly where to put the pieces of your snowman. In this project, you’ll take variables a step further: you’re going to create your own!
Anatomy of a Variable
First, let’s crack open a variable and see what it’s made of. This variable, called x, contains the number 23.
int x = 23;
A variable has three parts, and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access