Loading design...

A beautiful wavy string art gear created with Python Turtle. Read the code below, copy it, and try it in your own Python environment.
from turtle import *
import math
import colorsys
bgcolor("black")
tracer(30)
hideturtle()
speed(0)
width(1.5)
h = 0.3
R = 220
r = 67
for layer in range(3):
d = 90 + layer * 15
penup()
for i in range(6000):
theta = (i / 6000) * 20 * math.pi
x = (R - r) * math.cos(
theta) + d * math.cos(((R - r)
) * theta)
y = (R - r) * math.sin(
theta) - d * math.sin(((R - r)
) * theta)
rgb = colorsys.hsv_to_rgb(h, 0.9, 1)
color(rgb)
if i == 0:
goto(x, y)
pendown()
else:
goto(x, y)
h += 0.004
done()