Draw shapes with code!
Imagine a turtle with a pen. You tell it where to move, and it draws! Learn to create shapes, spirals, and art.
Turtle graphics is a fun way to draw pictures with code. Imagine a little turtle holding a pen. You tell it to move forward, turn left, turn right โ and it draws a line wherever it goes. You can create squares, stars, spirals, and more!
๐ก Think of it like this:
Think of the turtle like a remote-controlled toy car that paints as it drives. You send commands: "go forward 50 steps, turn right 90 degrees, go forward 50 more." The car paints a trail, and you have drawn a square!
Turtle graphics teaches you how code creates visual output. It is a stepping stone to understanding graphics, animation, and game development.
Where you see this in real life:
Turtle graphics was created in 1967 as part of the LOGO programming language. It was one of the first ways kids could learn programming by drawing!
Imagine a turtle holding a pen. You tell it to move forward, turn left, turn right โ and it draws a line wherever it goes. You can create squares, stars, spirals, and more! Since we cannot show turtle graphics in the browser, we will use text-based drawing to learn the same concepts.
To draw a square, the turtle moves forward and turns 90 degrees, four times. We can simulate this with text!
Click โถ Run to see the output!A star pattern uses the same loop and string multiplication trick!
Click โถ Run to see the output!A spiral grows wider with each step. We can simulate this with increasing line lengths!
Click โถ Run to see the output!Mix different characters to create colorful-looking patterns!
Click โถ Run to see the output!In turtle graphics, what does turning 90 degrees do?