A Loop Inside a Loop
Here is where drawings start to look like real art. Draw one shape with a loop. Then put that whole loop inside another loop that turns a little each time. Rangoli patterns work in exactly this way.
π‘ The idea
Putting one loop inside another turns a simple shape into a pattern.
- The inside loop draws one shape. The outside loop repeats and turns it.
- The turns of the outside loop should also add up to 360.
- Six turns of 60 make a six-part pattern. Eight turns of 45 make eight parts.
- The inside shape must finish where it started, or the pattern drifts away.
- Everything inside the outer brackets happens once per round.
π Words to know
- nested loop
- a loop written inside another loop
- pattern
- a shape repeated in a regular way
- rangoli
- a floor pattern drawn around a centre point
π Watch this
Six squares turned around one point, like a rangoli drawn on the floor.
colour purple repeat 6 [ repeat 4 [ forward 70 right 90 ] right 60 ]
βοΈ Your turn
- Run it and count the squares.
- Change the outer repeat 6 and right 60 to repeat 12 and right 30.
- Change the inside square into a triangle: repeat 3 [ forward 70 right 120 ].
- Try colour rainbow instead of purple.
- Make the shape smaller and the pattern bigger.
π― Challenge: Make a rangoli from eight triangles turned all the way around the centre.
Show me one answer
colour orange repeat 8 [ repeat 3 [ forward 80 right 120 ] right 45 ]
Your program