-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path__main__.py
68 lines (52 loc) · 1.28 KB
/
__main__.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""2025-01-01
Olá 2025
E viva a primeira rotação do ano de 2024
png
Sketch,py5,CreativeCoding
"""
import py5
from utils import helpers
sketch = helpers.info_for_sketch(__file__, __doc__)
MESES = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
ESPECIAIS = (
(2, 28),
(3, 3),
(5, 11),
(11, 18),
)
MARGEM = 40
PASSO = 20
def setup():
py5.size(helpers.LARGURA, helpers.ALTURA, py5.P3D)
py5.background(0)
py5.color_mode(py5.HSB, 360, 100, 100)
py5.rect_mode(py5.CORNER)
y = MARGEM * 3
for idy in range(0, 12):
h = idy * 20 + 30
s = idy * 20 + 50
y += PASSO
colunas = MESES[idy]
y += 20
x = 30
for idx in range(colunas):
py5.stroke(h, s, 100)
py5.stroke_weight(2)
py5.no_fill()
if idy == 0 and idx == 0:
py5.fill(h, s, 70)
elif (idy, idx) in ESPECIAIS:
py5.stroke(0, 100, 70)
py5.rect(x, y, PASSO, PASSO)
x += PASSO + 4
helpers.write_legend(sketch=sketch)
def key_pressed():
key = py5.key
if key == " ":
save_and_close()
def save_and_close():
py5.no_loop()
helpers.save_sketch_image(sketch)
py5.exit_sketch()
if __name__ == "__main__":
py5.run_sketch()