Drawing & Colors

Now that your students have been set up with a p5.js account, it’s time to work on their first creative coding project!

BIG IDEAS
  • Drawing shapes in p5.js involves writing out the sequence of steps you want the computer to do, using a “grammar” (syntax) that the computer will understand.
    • We can also say that we are writing out a sequence of instructions or commands. This sequence of instructions make up our algorithm.
  • Most p5.js projects will include code in both the setup() and the draw() functions. Instructions in setup() run once when you hit the play button. Instructions in draw() run over and over again.
    • Note: Functions is a bigger concept in coding that we will dig into more later. For now, we can just think of them as a way to organize our instructions into groups that do a thing. A decent analogy might be that lines of code are like “sentences” and a function is sort of like a “paragraph.
  • We set colors using color commands BEFORE we use the shape commands to draw the shapes. Then, we use the X-Y coordinate system to specify where to draw things with the shape commands.
LEARN
MOTIVATE
TEACH
PLAY
REFLECT