5
Enter the Matrix
You’ve created a number of wonderful things from shapes and lines, and even moved shapes around using an if() statement. Now I’ll cover how to combine the concepts you’ve learned to create images and transform all the pieces of your sketch at once, rather than transforming individual shapes.
WHAT IS A MATRIX?
When you create individual shapes with Processing, you’re actually placing them on a matrix. In simple Processing projects, you can think of a matrix as a way to group a lot of shapes and treat them as a single object. It’s a bit like drawing on a piece of paper: if you wanted to move the picture, you could erase it and redraw it—or you could simply move the whole piece of paper.
Without a matrix, you’d have to move every ...
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