from kandinsky import fill_rect from ion import keydown from time import monotonic s_sheep = (96,96,0,254,224,64,255,224,0,127,0,0,62,0,0,18,18,0) b_sheep = (126,6,0,255,7,2,255,7,0,254,0,0,124,0,0,72,72,0) def _draw(x, y, s, h, t): for i in range(0,18,3): for j in range(8): p_color = sum(map(lambda a: a>>j & 1,s[i:i+3])) if p_color: fill_rect(x+t*j,y+t*i//3,t,t,((255, 105, 180),(239, 228, 176),(0,180,246))[p_color-1]) def _degrade(x, y, w, h, c1, c2): for i in range(h): fill_rect(x, y+i, w, 1, tuple(c1[j]+(c2[j]-c1[j])*i//(h-1) for j in range(3))) _degrade(0,0,320,222,(239, 228, 176),(0,180,246)) _draw(10,10,s_sheep,0,10) _draw(10,100,b_sheep,0,10)