margarita.py

Created by schraf

Created on August 28, 2022

338 Bytes

Source : http://www.peda.com/grafeq/gallery.html

Chrome : https://my.numworks.com/python/schraf/chrome

Sphère : https://my.numworks.com/python/schraf/sphere

Threesome : https://my.numworks.com/python/schraf/threesome


from math import *
from kandinsky import *

fill_rect(0,0,320,222,(0,0,0))

for c in range(320):
 for l in range(222):
  x=(c-160)/3
  y=(l-111)/3
  v = sqrt(x*x+y*y)-3.5*atan2(x,y)+sin(x)+cos(y)
  if v % (7 * pi) < pi / 2: 
    set_pixel(c, 222 - l, (255,) * 3)
  elif v  % pi < pi / 2: set_pixel(c, 222 - l, (80,80,80))