Created
February 16, 2011 06:45
-
-
Save deontologician/828967 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
import turtle as T | |
from random import randint | |
def spiral(linefun, incr=4, angle=30, iterations = 30): | |
for i in xrange(0,iterations): | |
linefun(i*incr) | |
T.left(angle) | |
def regular_line(length): | |
T.forward(length) | |
def fuzzy_line(length): | |
for i in xrange(0,length): | |
T.forward(1) | |
if i % 2 == 0: | |
T.right(90) | |
hairlen = randint(0,10) | |
T.forward(hairlen) | |
T.right(180) | |
T.penup() | |
T.forward(hairlen) | |
T.pendown() | |
T.right(90) | |
if __name__ == "__main__": | |
T.reset() #put the turtle back at (0,0) | |
T.speed(0) # set turtle speed to fastest | |
T.pendown() # ready the turtle for drawing | |
spiral(fuzzy_line, angle=77) # create our drawing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment