-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_interpolation.py
44 lines (31 loc) · 1.11 KB
/
example_interpolation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from visuel import interpolate, fill_rect
from kandinsky import color
def draw_interpolate(C1: tuple | str, C2: tuple | str, N: int, position: tuple = (0, 0), taille: int = 1):
colors_interpolate = interpolate(C1, C2, N)
for n, col in enumerate(colors_interpolate):
fill_rect(position[0]+n*taille, position[1], taille, taille, color(col))
del colors_interpolate
# Exemple 1
def example_1():
for y in range(222):
draw_interpolate((255,255,0), (255,0,0), N=320, position=(0, y), taille=1)
example_1()
# Exemple 2
def example_2():
for y in range(222):
draw_interpolate((255,255,0), (0,255,255), N=320, position=(0, y), taille=1)
#example_2()
# Exemple 3
def example_3():
for y in range(0, 111):
draw_interpolate((255,255,255), (0,255,255), N=320, position=(0, y), taille=1)
for y in range(111, 222):
draw_interpolate((0,255,255), (255,255,255), N=320, position=(0, y), taille=1)
#example_3()
# Exemple 4
def example_4():
for y in range(222):
C1 = (255 - y, 255 - y, 255 - y)
C2 = (255 - y, 0 + y, 0 + y)
draw_interpolate(C1, C2, N=320, position=(0, y), taille=1)
#example_4()