Application that draw circles in a loop with varying radius
from kandinsky import * from math import * from ion import * cx = 320 // 2 cy = 222 // 2 x = 0 y = 0 r = 0 vr = 50 t = 0 n = 0 step = 0.01 t = 2*pi while t < 2*pi: set_pixel(cx + round(cos(t) * (r+1)),cy + round(sin(t) * (r+1)),(0,0,0)) t += 0.001 draw_string("n= " + str(n),0,0) kdown = False while True: if keydown(KEY_UP) and not kdown: n += 0.2 kdown = True fill_rect(0,0,320,222,(255,255,255)) t = 0 draw_string("n= " + str(n),0,0) if keydown(KEY_DOWN) and not kdown: n -= 0.2 kdown = True fill_rect(0,0,320,222,(255,255,255)) t = 0 draw_string("n= " + str(n),0,0) if not keydown(KEY_DOWN) and not keydown(KEY_UP): kdown = False if keydown(KEY_BACKSPACE): fill_rect(0,0,320,222,(255,255,255)) draw_string("n= " + str(n),0,0) t = 0 x = round(cos(t) * r) y = round(sin(t) * r) c = (abs(sin(t))*255,abs(cos(t*2))*255,abs(cos(sin(t*0.5)))*255) #fill_rect(cx, cy, x, y,c) #fill_rect(cx, cy, -x, -y,c) set_pixel(cx + round(cos(t) * (r+1)),cy + round(sin(t) * (r+1)),c) set_pixel(cx - round(cos(t) * (r+1)),cy - round(sin(t) * (r+1)),c) set_pixel(cx - round(cos(t) * (r+1)),cy + round(sin(t) * (r+1)),c) set_pixel(cx + round(cos(t) * (r+1)),cy - round(sin(t) * (r+1)),c) r = cos(n*t)*vr t += step