-
Notifications
You must be signed in to change notification settings - Fork 0
Home
welcome to the wiki for let-us-play-polygonal-spirals!
this is your one-stop guide to understanding, running, and contributing to this collection of mesmerizing geometric patterns created with python's turtle graphics. whether you're here to learn, experiment, or just stare at pretty spirals, you're in the right place.
| Page | What You'll Find |
|---|---|
| π Home | You are here! Overview and quick start |
| β¨ Credits | The awesome people & things that made this possible |
| π€ Contributing | Want to add your own spirals? Start here! |
imagine drawing a triangle, but each side gets a little bit longer every time you draw it. you keep turning at the same angle, but because the sides are growing, you create this expanding, spiraling pattern.
that's basically what we're doing here, but with:
- πΊ Triangles (3 sides)
- β¬ Pentagons (5 sides)
- ⬑ Hexagons (6 sides)
- β Circle-ish shapes (50 sides!)
1. Clone the repository
git clone https://github.com/willow788/let-us-play-polygonal-spirals.git
cd let-us-play-polygonal-spirals2. Choose your spiral
cd "Python Code Files/Hexagon Code"3. Run it!
python main.py4. Get hypnotized ποΈπ
it's surprisingly simple!
Formula for turning angle:
angle = 360Β° / number_of_sides
The spiral magic:
for i in range(iterations):
forward(length) # draw a line
right(angle) # turn
length += 1 # THIS makes it a spiral! that length += 1 is where the magic happens. without it, you'd just get a regular polygon. with it, you get an ever-expanding hypnotic pattern.
- Angle: 120Β°
-
Color: Green
#229302 - Iterations: 500
- Vibe: Sharp and chaotic
- Angle: 72Β°
-
Color: Magenta
#9C026B - Iterations: 500
- Vibe: Elegant and balanced
- Angle: 60Β°
- Color: Cyan
- Iterations: 2000
- Vibe: The OG, where it all started
- Angle: 7.2Β°
-
Color: Magenta
#9C026B - Iterations: 20000
- Vibe: Weird but fascinating
here's what you can play with:
Change Colors:
color("purple") # or any color you like
bgcolor("white") # try different backgroundsModify Sides:
sides = 7 # try a heptagon!
sides = 12 # or a dodecagon!Adjust Speed:
speed(0) # fastest (instant)
speed(5) # medium (watch it draw)
speed(1) # slowest (very meditative)Change Growth Rate:
length += 2 # grows faster
length += 0.5 # grows slower- check out the Contributing page if you want to add your own spirals
- look at the Credits page to see who made this happen
- peek at the code - it's super simple and well-commented
- the hexagon spiral was the first one coded in this repo
- the 50-sided "circle" looks kinda like buri buri zaimon's nose from shinchan (if you know, you know)
- all the code was rewritten from scratch for each shape as practice (not because anyone's a donkey, but because practice makes perfect!)
- this whole project started on a chilly january morning