Skip to content

Instantly share code, notes, and snippets.

@Galacs
Last active January 26, 2022 17:28
Show Gist options
  • Save Galacs/7f5fcb28345fcec520733a1e309b9ca6 to your computer and use it in GitHub Desktop.
Save Galacs/7f5fcb28345fcec520733a1e309b9ca6 to your computer and use it in GitHub Desktop.
arc_en_ciel
from math import *
from kandinsky import *
from random import *
from math import *
def degrade(c1,c2,k):
dr=c2[0]-c1[0]
dg=c2[1]-c1[1]
db=c2[2]-c1[2]
return color(c1[0]+int(k*dr),
c1[1]+int(k*dg),c1[2]+int(k*db))
def ye():
if (input() != "yay"): return
print("You're in")
def couleur(x,y):
d=sqrt((x-160)**2+(y-111)**2)/32.5
return degrade(c[int(d)],
c[(int(d)+1)%6],d-int(d))
def tirage():
for i in range(n):
x=randint(0,320)
y=randint(0,222)
c=couleur(x,y)
set_pixel(x,y,c)
set_pixel(x+1,y,c)
set_pixel(x,y+1,c)
set_pixel(x+1,y+1,c)
c=[[255,0,0],[255,255,0],[0,255,0],
[0,255,255],[0,0,255],[255,0,255]]
n=5000
tirage()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment