Learning Goals 3 min
By the end of this lesson you will be able to:
- Combine move (3) steps with turn cw (7) degrees inside a long repeat (300) to draw a smooth circular spiral — a spirograph.
- Use change pen color by (2) inside the loop to make the spirograph shift gradually through the rainbow as it draws.
- Experiment with the turn angle — try 5, 7, 11, 13 (prime numbers especially) — and explain why different angles give wildly different shapes.
Warm-Up — what happens if you turn the wrong angle 7 min
Last lesson you drew an 8-petal kolam by carefully picking turns that divided 360 evenly. Today we're going to do the opposite: pick turns that don't divide 360 cleanly, and watch something amazing happen.
Quick mental quiz. If a sprite does repeat (8) + move (50) steps + turn cw (45) degrees, what shape appears?
Reveal the answer
A clean octagon — closed, sharp corners, sprite back where it started. 8 × 45 = 360, so the cat completes exactly one revolution and the shape closes.
Now the curious one. Same script, but turn 7 degrees instead of 45, and repeat 300 times. What shape appears?
Reveal the answer
A circle. 300 × 7 = 2100 degrees, which is almost 6 full turns around the centre. With each step only 3 pixels long and each turn only 7°, the sprite never makes a sharp corner — it just curls. The eye reads the result as one big smooth ring.
That's the secret of spirograph art: tiny moves + tiny turns = curves. Big moves + big turns = polygons. Same blocks, different numbers, totally different look.
Today's project takes this trick and adds one more thing — a colour that shifts as the spiral draws. The result looks like a kaleidoscope.
New Concept — small steps, small turns, and prime angles 15 min
A spirograph is built from three ideas working together: tiny movement, tiny rotation, and a long-running loop. Drop them into a colour-changing pen, and a hypnotic ring appears.
Idea 1 — tiny moves and turns make curves
Move 50 steps, turn 45°. Move 50 steps, turn 45°. Your eye sees flat sides and sharp corners — an octagon. Now imagine the steps and turns are 10× smaller: move 5 steps, turn 4.5°. Same shape mathematically, but the corners are so tiny and the sides so short, your eye smooths them into a curve. That's all a circle is on a screen — a polygon with so many sides you can't see them.
repeat (300)
move (3) steps
turn cw (7) degrees
end
Idea 2 — why prime angles look different
Here's where it gets interesting. 7 is a prime number — it doesn't divide evenly into 360. So when the cat makes its first full revolution (after about 51 turns of 7° each — 51 × 7 = 357), it isn't quite back at its starting direction. It's 3° off. On the second revolution it's 6° off. On the third, 9° off. The circle keeps shifting slightly, and the overlap traces out a thick, complex ring.
Try other primes: 5, 11, 13. Each gives a different pattern because the "off by" amount per revolution is different. 11 and 13 produce especially gorgeous patterns because they're nowhere near a clean divisor of 360.
repeat (300)
move (3) steps
turn cw (11) degrees
end
Idea 3 — colour that shifts as it draws
To turn the spirograph into rainbow art, drop change pen color by (2) inside the loop. Each time around, the pen colour nudges 2 points along the colour wheel. After 300 loops that's 600 colour-points — almost two full rainbows. The spiral becomes a continuous colour gradient.
repeat (300)
move (3) steps
turn cw (7) degrees
change pen color by (2)
end
Worked Example — your first rainbow spirograph 15 min
Open Scratch. Pen extension on (bottom-left blue button → Pen). We'll build the whole project in nine steps.
Step 1 — Start fresh, centre the cat
New project. Drag the cat to x: 0, y: 0. From Motion, click point in direction (90) once so it's facing right.
Step 2 — Drop the hat
From Events: when ⚑ clicked.
Step 3 — Wipe the Stage
From Pen: erase all. Snap it under the hat.
Step 4 — Jump to centre and lock direction
From Motion: go to x: (0) y: (0) and point in direction (90). This makes every run identical no matter where the cat ended last time.
Step 5 — Set the pen thin
From Pen: set pen size to (2). A spirograph wants a fine, almost wiry line — the colour layering does the visual work.
Step 6 — Pick a starting colour
From Pen: set pen color to []. Click the swatch and pick any colour — magenta or cyan are fun starters. The colour will shift on its own once the loop runs.
Step 7 — Pen down
From Pen: pen down. Now the cat is ready to leave a trail.
Step 8 — The loop
From Control: repeat (300). Inside it, snap (in order): move (3) steps, turn cw (7) degrees, change pen color by (2).
Step 9 — Click the flag
The cat starts spinning at the centre. A rainbow ring appears, deepens, overlaps itself, and ends as a hypnotic gradient curl. Click the flag again — wiped clean and redrawn instantly.
The full assembled stack
when flag clicked
erase all
go to x: (0) y: (0)
point in direction (90)
set pen size to (2)
set pen color to [#FF00FF]
pen down
repeat (300)
move (3) steps
turn cw (7) degrees
change pen color by (2)
end
pen up
What you just built: a parametric curve. The cat doesn't know what shape it's drawing — it just walks, turns, walks, turns. The pattern emerges from the rules. This is the same idea behind every fractal, every game-of-life cellular automaton, every Mandelbrot zoom: simple local rules, beautiful global shapes.
Try It Yourself — three spirograph experiments 15 min
Goal: Change just the turn angle. Try the prime numbers 5, 11, and 13. Hit the flag between each change. Notice how the shape transforms.
when flag clicked
erase all
go to x: (0) y: (0)
point in direction (90)
set pen size to (2)
set pen color to [#00FFFF]
pen down
repeat (300)
move (3) steps
turn cw (13) degrees
change pen color by (2)
end
pen up
Think: The only number that changed is the turn. Every other block stayed identical. That's how powerful a single number can be — sometimes the whole personality of a drawing is one digit.
Goal: Add a second spirograph, drawn after the first, with a different angle and offset starting position. Use pen up + go to x: () y: () + pen down in between so the move doesn't draw a line.
when flag clicked
erase all
go to x: (-80) y: (0)
point in direction (90)
set pen size to (2)
pen down
repeat (200)
move (3) steps
turn cw (7) degrees
change pen color by (2)
end
pen up
go to x: (80) y: (0)
pen down
repeat (200)
move (3) steps
turn cw (11) degrees
change pen color by (3)
end
pen up
Think: You're under L4's 30-block cap (about 19 blocks here). Adding a third? You'd run out of room — that's the moment to think about making a draw spirograph (turn) My Block to fold the duplication. (We'll do that later in the cluster.)
Goal: Make the pen size grow as the spirograph draws. Add change pen size by (0.05) inside the loop. The spirograph starts as a thin wiry inner ring and ends as fat outer brush strokes.
when flag clicked
erase all
go to x: (0) y: (0)
point in direction (90)
set pen size to (1)
set pen color to [#FF0080]
pen down
repeat (300)
move (3) steps
turn cw (7) degrees
change pen color by (2)
change pen size by (0.05)
end
pen up
Think: Pen size goes from 1 to 1 + (300 × 0.05) = 16. From a wire to a thick brush. Try negative change pen size by (-0.05) for the opposite — fat to thin.
Mini-Challenge — Faiz's boring polygon 5 min
"It's supposed to be a spirograph but it's just a circle"
Faiz copied the worked example but changed the turn to 10. He hits the flag and gets a perfectly clean, single-colour 36-sided shape that looks like a circle — no overlap, no swirl, no kaleidoscope. He's disappointed.
when flag clicked
erase all
go to x: (0) y: (0)
point in direction (90)
set pen size to (2)
set pen color to [#FF00FF]
pen down
repeat (300)
move (3) steps
turn cw (10) degrees
change pen color by (2)
end
pen up
What's wrong with using 10 as the turn?
Reveal one valid solution
10 divides 360 cleanly — 360 / 10 = 36. So after exactly 36 turns the cat is back facing its original direction, and the shape closes. The remaining 264 turns just retrace the same 36-sided polygon over and over. No new lines appear, just colour layering on top of the same path. Faiz gets one boring ring.
The fix is to pick a number that doesn't divide 360. Primes are the safest bet:
when flag clicked
erase all
go to x: (0) y: (0)
point in direction (90)
set pen size to (2)
set pen color to [#FF00FF]
pen down
repeat (300)
move (3) steps
turn cw (7) degrees
change pen color by (2)
end
pen up
One number changed — 10 to 7. The shape no longer closes after 36 steps, so every revolution is slightly offset from the last, and the overlapping rings make the spirograph. The lesson: clean divisors of 360 close the shape. Primes keep it spiralling. The "ugly" math angles are the prettiest.
Recap 3 min
You finished your second Cluster B pen project — a spirograph. The recipe is tiny moves + tiny turns + a long repeat + a colour shift. Pick a prime turn (5, 7, 11, 13) and the shape never closes cleanly, so each revolution overlaps the last and a hypnotic ring emerges from rules so simple they fit in eight lines. The same trick — local rules producing global pattern — is the foundation of fractals, cellular automata, and procedural art.
- Spirograph
- A drawing made by repeatedly moving a small distance and turning a small angle, often with a colour shift. The overlap creates a swirl. Named after a 1960s toy that used gears to do the same thing mechanically.
- Prime angle
- A turn whose value (5, 7, 11, 13, ...) is a prime number — it doesn't divide 360 cleanly. Every revolution lands offset from the last, so the path keeps unfolding instead of closing.
- change pen color by
- A Pen block that nudges the current pen colour along the rainbow wheel. Negative values nudge backwards. Inside a long loop, it makes the entire drawing into a smooth gradient.
- Parametric curve
- A drawing where the shape emerges from a rule, not from explicit coordinates. The cat doesn't know it's drawing a spirograph — it just walks 3 steps and turns 7°, over and over, and the pattern appears.
- Emergent behaviour
- When simple local rules give rise to a complex global outcome. Spirograph art, ant trails, and snowflakes are all emergent.
Homework 2 min
The Three-Spirograph Showcase. Build a .sb3 file that draws three different spirographs on the same Stage, one after another, each with a different prime turn.
- Start from the worked example. Save as
HW-L4-11-Spirographs.sb3. - First spirograph: turn = 5°, centre at
x: -120, y: 60, repeat 200. - Between drawings: pen up, go to x: () y: () for the new centre, pen down. (Otherwise you'd draw a streak between them.)
- Second spirograph: turn = 11°, centre at
x: 120, y: 60, repeat 200. - Third spirograph: turn = 13°, centre at
x: 0, y: -90, repeat 200. - Each spirograph starts with a different set pen color to [] for visual variety.
- Stay under 30 blocks total. (You'll be close — about 25.)
Bring back next class:
- The
.sb3file. - Your answer to: "Which of your three turn angles (5, 11, 13) gave the prettiest pattern, and why do you think that is?"
Heads up for next class: SCR-L04-12 starts a brand-new cluster — Cluster C: Music Extension. We'll leave the pen behind for a few lessons and add a pink Music palette to the editor, with drum hits, instrument notes, and tempo. Same "extension" mechanism you used for Pen.