julia.py

Created by vef03715

Created on February 01, 2021

491 Bytes


import kandinsky
def julia(N_iteration):
  for x in range(320):
    for y in range(222):
#      z = complex(0,0)
#      c = complex(3.5*x/319-2.5, -2.5*y/221+1.25)
      c = complex(-0.8,0.156)
      z = complex(5*x/319-2.5, -2.5*y/221+1.25)
      i = 0
      while (i < N_iteration) and abs(z) < 2:
        i = i + 1
        z = z*z+c 
      rgb = int(255*i/N_iteration)
      col = kandinsky.color(int(rgb*0.82),int(rgb*0.13),int(rgb*0.18))
      kandinsky.set_pixel(x,y,col)