IAT 806 · Intro to Computing · Fall 2026
Instructor: Dr. Alireza Karduni · akarduni@sfu.ca
You start thinking about that project this week.
All of your work this term lives in GitHub repositories you own, starting today.
That is it for now. We learn about branches later.
Commit often. A commit is a save point you can return to. Do it often.
createCanvas, circle, fill, mouseXTwo files in a folder.
index.html
The HTML loads p5, then loads your code. You will spend the term in the right-hand file.
setup() and draw()setup() runs once, at the start. Make the canvas here.draw() runs over and over, about 60 times a second, forever.createCanvas(400, 300) makes a grid 400 wide and 300 tall(0, 0) is the top-left cornerx grows to the right, y grows downwardThat downward y is the part that will trip you up for about a week.
mouseX and mouseY are variables p5 keeps updated for youwidth and height are the canvas size — use them instead of retyping 420draw() is redrawing this whole grid 60 times a secondEvery one of these is in the p5.js reference. Keep it open. Nobody memorises the argument order.
fill(r, g, b) — the inside of a shapestroke(r, g, b) — the outlinebackground(r, g, b) — the whole canvasfill(0) black, fill(255) whitefill(255, 0, 0, 40)noFill() and noStroke() turn each offOrder matters: fill() applies to every shape drawn after it, until you change it again.
circle lines — what happens to the overlap?150 to 40stroke(0) at the top of draw()background() is really forbackground() erases the previous frameindex.html and sketch.js, get a canvas on screenMotion and interaction — variables, the draw loop, mouse and keyboard input, conditionals, and program state.
IAT 806 · Intro to Computing · Fall 2026