Introduction: Create Stunning Geometric Art in Scratch
Welcome to an exciting journey where coding meets creativity! In this comprehensive Create Stunning Geometric Art in Scratch tutorial, you’ll learn how to draw fascinating geometric shapes and bring them to life using vibrant colors, smart loops, and the powerful pen extension tool in Scratch. Whether you’re just starting out with Scratch programming for beginners or looking to level up your skills with some artistic inspiration, this guide is perfect for you.
Created by Omaansh Aggarwal from Kodex Academy, this tutorial walks you through step-by-step how to combine logic and artistry to generate stunning geometric art. The video shows how to use loops in Scratch, control angles and movement, and draw patterns that are both visually appealing and mathematically intriguing. This is an ideal project for those interested in Scratch creative coding, STEM art, or integrating math into programming.
By following this tutorial, you’ll gain hands-on experience with:
- Drawing complex Scratch geometric shapes
- Using count-controlled loops effectively
- Learning how the pen extension can transform sprites into drawing tools
- Exploring coding geometric patterns in Scratch using simple nested loops
- Creating a dynamic Scratch shapes animation
And the best part? You don’t need any prior experience. All you need is curiosity and a desire to explore the artistic side of programming.
Watch the full video tutorial here: Create Stunning Geometric Art in Scratch | Draw Art + Math Combo Patterns
This project is perfect for school coding clubs, STEAM learning activities, or even weekend fun with family and friends. Not only will you master Scratch fundamentals, but you’ll also walk away with a digital masterpiece you created entirely with code.
So if you’re looking for Scratch coding ideas, or just want to try something fun and visual with loops, motion, and color — let’s dive in and unlock the magic of Scratch pen tool drawing and geometry-based animations. Let’s code some art!
Step-by-Step Coding: Create Stunning Geometric Art in Scratch
Step 1: Set Up the Scratch Environment
1. Create a New Project
- Go to https://scratch.mit.edu and start a new project.
- Delete the default cat sprite.
2. Paint a Custom Backdrop
- Click on the Stage → Backdrops tab.
- Choose “Paint” to create a new backdrop.
- Use the Fill Tool to select a black background.
- Convert it to Bitmap Mode and click once to apply.
Step 2: Add a Drawing Sprite (Pencil)
- Click “Choose a Sprite” → Search for “Pencil” (or draw your own).
- Customize the costume if needed.
- This sprite will act like a virtual pen.
Step 3: Add the Pen Extension
- Click the “Extensions” button (bottom left).
- Select the Pen Extension.
You’ll now have access to blocks like:
pen down
pen up
set pen color
set pen size
erase all
Step 4: Start with Basic Pen Setup
Use this block sequence to get started:
when green flag clicked
erase all
set pen size to 2
set pen color to [#800000] // Maroon or choose your own
go to x: -40 y: -50
point in direction 90
pen down
Explanation:
erase all
clears the canvas.- Pen size and color are configured for drawing.
- Sprite is placed at a starting coordinate.
- Direction 90 points the sprite to the right.
Step 5: Draw a Polygon Using Loops
Let’s draw a hexagon (6-sided shape) using a nested repeat loop.
repeat 15 // Draw the shape 15 times to create pattern
repeat 6
move 50 steps
turn 60 degrees
end
turn 24 degrees // Angle = 360° / 15
end
pen up
What’s Happening?
- Inner loop draws a hexagon (6 equal sides, 60° each).
- Outer loop repeats the hexagon drawing at different angles, forming a circular pattern.
turn 24
between each shape = evenly spaced rotation (360°/15)
You can try different values like:
repeat 10
outer,repeat 5
inner for pentagon patterns- Change
move
steps to vary size
Step 6: Add More Shapes (Multi-Color)
Duplicate the previous code and modify:
set pen color to [#00FF00] // Green
go to x: 13 y: 120
pen down
repeat 10
repeat 6
move 30 steps
turn 60 degrees
end
turn 36 degrees // 360° / 10
end
pen up
Repeat for more shapes using these settings:
Color | Position (X, Y) | Outer Repeat | Inner Repeat | Step Size | Turn Angle |
---|---|---|---|---|---|
Pink | 75, 50 | 15 | 5 | 30 | 24° |
Red | -175, 63 | 20 | 4 | 40 | 18° |
⚠️ Important Tip: Always add pen up
before moving the sprite to a new position to avoid unwanted lines.
Step 7: Show All Shapes on One Canvas
To see all shapes together:
- Remove all
erase all
blocks except one at the beginning of your code (underwhen green flag clicked
). - This ensures shapes aren’t cleared between drawing.
If a line appears between shapes:
- Add
pen up
beforego to
block - Then use
pen down
before drawing starts
Reset with Erase All on Flag
when green flag clicked
erase all
This ensures the canvas is cleared every time you start the program.
Complete Code Summary
Here’s a compact version to draw one complete shape:
when green flag clicked
erase all
// Maroon shape
set pen size to 2
set pen color to [maroon]
go to x: -40 y: -50
point in direction 90
pen down
repeat (15) {
repeat (7) {
move (50)
turn cw (60)
}
turn cw (36)
}
pen up
// Green shape
set pen color to [green]
go to x: 13 y: 120
pen down
repeat (10) {
move (30)
turn cw (36)
}
pen up
// Pink shape
set pen color to [pink]
go to x: 75 y: 50
pen down
repeat (15) {
move (30)
turn cw (24)
}
pen up
// Red shape
set pen color to [red]
go to x: -175 y: 63
pen down
repeat (20) {
move (40)
turn cw (18)
}
pen up
// Keep one erase-all only at the start via green flag
Experiment Ideas:
- Try
repeat 36
andturn 10°
for spirograph-style patterns. - Use
pick random
color blocks for vibrant animations.
Enhancements (Bonus Ideas)
a. Animated Drawing
Add wait 0.1 seconds
inside inner loop for drawing effect:
repeat 6
move 50 steps
turn 60 degrees
wait 0.1 seconds
end
b. Random Colors
set pen color to [pick random color]
c. User-Controlled Shape Count
Ask the user for number of sides:
ask [How many sides?] and wait
set [sides v] to (answer)
Then replace repeat 6
and turn 60 degrees
with:
repeat (sides)
move 50 steps
turn (360 / sides) degrees
end
d. Freehand Drawing Mode
Create a mini paint app:
when green flag clicked
forever {
go to [mouse-pointer v]
if <mouse down?> then pen down else pen up
}
Useful for Scratch creative coding and interactive animations.
e. Parameterize via Custom Blocks (My Blocks)
Define reusable drawing blocks:
define DrawPattern from x: (x) y: (y) color: (c) sides: (s) size: (sz)
go to x: (x) y: (y)
set pen color to (c)
pen down
repeat (s) {
move (sz) steps
turn cw (360 / s) degrees
}
pen up
Incorporate variables for ultimate flexibility.
f. Color & Size Dynamics with Variables
Use sliders/variables to animate pen attributes:
when green flag clicked
set pen size to (sizeVar)
set pen color to (colorVar)
...
Let users control brush styles dynamically.
g. Complex Patterns with Nested Loops
Build snowflakes or fractal designs:
repeat (6) {
repeat (3) {
move (50) steps
turn cw (60) degrees
}
turn cw (60) degrees
}
Conclusion: Unlocking Creativity with Scratch Coding and Geometric Art
Through this step-by-step Scratch tutorial, you’ve just explored how to combine math, logic, and creativity to generate dynamic geometric art using Scratch’s Pen extension and count-controlled loops. Whether you’re a complete beginner or a young coder discovering the magic of shapes, this project helps solidify fundamental programming concepts in a fun and visual way.
You learned how to:
- Use loops (
repeat
blocks) to draw patterns efficiently - Apply pen controls to manage drawing behaviors and aesthetics
- Avoid unwanted lines using
pen up
andpen down
- Position sprites for organized designs
- Use color, shape, and motion creatively
This project is more than just about drawing—it’s about thinking like a programmer:
- Breaking down tasks into logical steps
- Using repetition and modularity to create patterns
- Experimenting with variables and user inputs
- Understanding the connection between math (angles, geometry) and visual design
Call to Action
- Don’t forget to check out the full video tutorial by Kodex Academy here: Create Stunning Geometric Art in Scratch | Draw Art + Math Combo Patterns with Kodex Academy!
- Like, comment & share the video
- Visit kodexacademy.com
- subscribe to the Kodex Academy YouTube channel for deeper Scratch content.
Happy coding with Kodex Academy! 🚀
Learn More with Kodex Academy
At Kodex Academy, we’re passionate about helping students learn coding in creative ways. This project teaches more than Scratch—it empowers young minds to build tools that work in the real world.
Explore more:
Stay updated with new content, free tutorials, and coding challenges!
- 🌐 Website: https://kodexacademy.com
- 🌐 Website: https://games.kodexacademy.com
- 💬 WhatsApp Channel: Join Now
- 💼 LinkedIn: Kodex Academy
- 📸 Instagram: @kodex_academy
- 𝕏 Twitter: @Kodex_Academy
- 📢 Telegram: Join Our Channel
- 🔗 Patreon: patreon.com/KodexAcademy
Further Reading & Links
- Scratch Wiki Motion Blocks: https://en.scratch-wiki.info/wiki/Motion_Blocks
- Scratch Programming for Beginners: https://scratch.mit.edu/projects/editor
- Scratch Animation Guide: https://en.scratch-wiki.info/wiki/Animating