from turtle import * from random import * from kandinsky import fill_rect from time import sleep NB = 10 hideturtle() svg = ['M',16,89,'C',16,89,28,80,28,80,28,80,28,123,28,123,'M',58,84,'C',62,81,79,78,78,89,76,100,56,119,57,121,58,124,79,124,80,124,'M',100,77,'C',105,77,113,79,112,87,112,94,108,98,101,98,93,98,89,102,89,109,89,115,93,123,101,123,109,123,113,114,113,109,113,104,106,98,101,98,96,98,90,93,90,88,89,82,94,77,100,77,'Z','M',118,95,'C',119,94,127,92,127,92,127,92,140,127,140,127,140,127,156,62,156,62,156,62,301,62,301,62,'M',161,112,'C',164,116,176,116,178,114,181,111,183,98,170,99,157,99,155,116,161,123,166,130,177,127,180,124,'M',223,102,'C',220,110,202,110,202,100,201,90,205,82,213,82,235,88,222,122,208,125,'M',249,98,'C',244,98,238,94,238,88,238,83,243,77,250,77,257,77,261,81,261,89,261,96,256,98,250,98,244,98,237,103,237,110,238,117,242,124,250,123,258,123,262,115,262,110,262,105,255,98,249,98,'Z','M',288,78,'C',278,78,276,88,276,99,276,109,278,118,287,118,296,118,298,108,298,100,298,92,298,78,288,78,'Z','M',279,142] def move(x,y): pensize(randint(3,5)) goto(x-160,110-y) def coord(a,b,c,d,t): return a*(1-t)**3+3*b*t*(1-t)**2+3*c*t*t*(1-t)+d*t**3 def bezier(l): pendown() t = 0 for i in range(NB+1): x = coord(l[0],l[2],l[4],l[6],t) y = coord(l[1],l[3],l[5],l[7],t) move(x,y) t += 1/NB speed(5) i = 0 while i<len(svg): if svg[i] == "M": l = [svg[i+1],svg[i+2]] penup() move(l[0], l[1]) i += 3 elif svg[i] == "Z" or svg[i] == "C": i += 1 else: for j in range(6): l.append(svg[i+j]) bezier(l) l = [svg[i+4],svg[i+5]] i += 6 for l in range(58,99): fill_rect(0,l,320,1,(255,)*3) sleep(.1)