How to Draw Patterns in Scratch

How to Draw Patterns in Scratch

This tutorial shows how the same small set of blocks can generate lots of different patterns and act as an interactive pattern-drawing tool.

What You Need to Get Started

It’s simple to begin. You need:

  • The Pen Extension (click the purple Extensions button at the bottom-left of the editor) Scratch Extenstion

  • A basic understanding of blocks like move, turn, repeat, and variables

  • An interest in experimenting with shapes and code

You can also follow along with the video tutorial to see how it all comes together.


How Math is Neccesary for Programming

Before dragging any block, it helps to understand what drawing an equilateral shapes means. Every equilateral polygon (like a triangle, square, or hexagon) is made by repeating two things: drawing a line and a turn. The turn is based on a simple rule:

360 divided by the number of sides = the angle to turn after each side.

Using this formula as the foundation for the code allows drawing any equilateral polygon. Repeating the shape around a circle generates complex patterns.

Want to read more details? Take a look at the blog blow: drawing polygons in Scratch


Key Concepts and how they work

As you build the project, you’ll use several Scratch concepts that are great to understand:

  • Center the Pattern: Always reset the sprite’s position before drawing. A quick go to x: 0 y: 0 keeps the pattern in the center **Go to x y **
  • Variables and Sliders: Sliders let you adjust sides, length, color, and repetition, without editing the code, you can even add limits. Properties Slider
  • Nested Repeat Loops: One loop draws the shape, another repeats it in a pattern.
  • Custom Blocks: Keeps the code organized and easier to manage.
  • Run without screen refresh: ensures the custom block happens instantly Custom Block
  • Erase all: Clears the screen from pen Erase All
  • Pen up: stops pen from drawing anything, until pen down is used again. Pen Up

How the Code Works

  • Draw a single polygon using repeat based on the variables “sides” and “length” values
  • Repeat that shape around a circle to form a radial pattern
  • Use custom block (e.g., DrawPattern)

A Simple Project with Great Learning Potential

This is the kind of project that shows Scratch is more than just a coding tool. It’s a great fit for:

  • Introducing geometry in a visual and engaging way
  • Showing how math can be applied in coding
  • Encouraging exploration through sliders and experimentation
  • Helping students understand concepts like loops, angles, and modular thinking

Finished This Tutorial?

Great job! In the next post, How to correctly use the forever loop: fHow to correctly use the forever loop you’ll learn how to optimize the forever loop to avoid unnecessary redrawing while keeping the project interactive and smooth.

Join our YouTube channel for more Scratch tutorials that make programming fun and easy to follow.

Happy Coding!
TheSTEAMIst
The STEAMistt Avatar
Last updated on