Use Scratch to build a random art generator that creates colorful patterns with sprites, shapes, and code blocks, learning programming and creative experimentation.



Step-by-step guide to build a random art generator with Scratch
Step 1
Open Scratch and start a new project.
Step 2
Click the blue Extensions button and add the Pen extension.
Step 3
Create a brush sprite by clicking Paint and drawing a small filled circle.
Step 4
Select the brush sprite in the sprites list.
Step 5
Drag a "when green flag clicked" hat block into the brush sprite’s scripting area.
Step 6
Attach a "clear" block directly under the hat block.
Step 7
Attach a "go to x: 0 y: 0" block under the clear block.
Step 8
Attach a "pen down" block under the go to block.
Step 9
Attach a "set pen size to 4" block under the pen down block.
Step 10
Attach a "repeat 200" block under the pen size block.
Step 11
Put a "set pen color to (pick random 1 to 200)" block inside the repeat loop.
Step 12
Put a "move (pick random 5 to 20) steps" block inside the repeat loop.
Step 13
Put a "turn 15 degrees" block inside the repeat loop.
Step 14
Click the green flag to run your random art generator and watch the colorful pattern form.
Step 15
Share your finished Scratch project on DIY.org.
Final steps
You're almost there! Complete all the steps, bring your creation to life, post it, and conquer the challenge!


Help!?
What can we use instead if we can't add the Pen extension or can't paint a brush sprite?
If you can't add the Pen extension or paint a brush sprite, choose a built‑in round sprite or draw a small filled circle and use the 'stamp' block inside the repeat loop instead of 'pen down' to leave marks.
Why doesn't any art appear when I press the green flag and how do I fix it?
If nothing draws when you click the green flag, make sure you added the Pen extension and that the brush sprite's script starts with 'clear', 'go to x: 0 y: 0', and a 'pen down' and 'set pen size to 4' placed before the 'repeat 200' loop.
How can I change the activity to suit younger or older kids?
For younger kids change 'repeat 200' to 'repeat 50' and fix 'move' to a small number so they see results quickly, while older kids can replace 'turn 15 degrees' with 'turn (pick random -90 to 90) degrees' and add 'change pen size by (pick random 1 to 5)' inside the loop.
How can we make the generator more interesting or personalize our design?
To personalize the generator add a second painted brush sprite with its own script using 'set pen size to 8' and a different 'turn' value or create a stage variable slider that sets the 'set pen size to' or 'repeat' value before clicking the green flag.
Watch videos on how to build a random art generator with Scratch
Facts about Scratch programming for kids
🎨 Generative art uses rules and algorithms so the same program can produce endless different artworks.
🧩 In Scratch, sprites can draw by using pen blocks or stamp shapes to build colorful designs.
🔁 Random number blocks, when combined with loops and motion, can create surprisingly complex patterns.
🐱 Scratch was created by the MIT Lifelong Kindergarten Group and was first released in 2007.
🌈 Small changes to hue, brightness, or transparency can turn simple shapes into rich, layered patterns.


Only $6.99 after trial. No credit card required