Created
September 20, 2018 17:51
-
-
Save rhoit/1ed646e1c18d45234391d62845e28247 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import math | |
import turtle | |
turtle.speed(0) | |
# turtle.tracer(n=0, delay=0) | |
def square(length): | |
for i in range(4): | |
turtle.forward(length) | |
turtle.right(90) | |
def spiral(length=100, angle=90, add=0, steps=4): | |
a = 3 | |
turtle.right(a) | |
for i in range(steps): | |
h = length / math.cos(math.radians(a)) | |
turtle.forward(h) | |
length -= h * math.sin(math.radians(a)) | |
turtle.right(angle + a) | |
for i in range(-2, 3): | |
for j in range(-2, 3): | |
turtle.goto(j*80, i*80) | |
# square(80) | |
turtle.setheading(45) | |
turtle.circle(56.5, steps=4) | |
turtle.setheading(0) | |
spiral(-80, steps=50) | |
turtle.update() | |
turtle.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment