from kandinsky import * from math import sin, cos fill_rect(0,0,320,222,(0,0,0)) def degrade(a, b, nbVal = 10): (r1,g1,b1) = a (r2,g2,b2) = b dr = int((r2 - r1) / nbVal) dg = int((g2 - g1) / nbVal) db = int((b2 - b1) / nbVal) color = [] for i in range(nbVal): color.append((r2, g2, b2)) r2 = r2 - dr g2 = g2 - dg b2 = b2 - db return color color = degrade((255,255,0), (255,0,255), 100) x,y,z=.3,.6,.1 a,b,c=.082,.1,14 dt=.025 n=0 while n < 12000: n+=1 dx=-y-z dy=x+a*y dz=b+z*(x-c) x+=dx*dt y+=dy*dt z+=dz*dt g=color[n%90] set_pixel(int(7*x/(z+.9)+170),int(5-1.2*(y-100)/(z+.7)),g)