-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqix-code.py
More file actions
39 lines (32 loc) · 908 Bytes
/
Copy pathqix-code.py
File metadata and controls
39 lines (32 loc) · 908 Bytes
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
import math
import random
from brteve.brt_eve_bt817_8 import BrtEve
from brteve.brt_eve_rp2040 import BrtEveRP2040
host = BrtEveRP2040()
eve = BrtEve(host)
eve.init(resolution="1280x800", touch="goodix")
def tri(triangle):
# triangle wave
f = math.fmod(triangle, 1.0)
return 2 * abs(f - 0.5)
def at(triangle, ff):
x = eve.lcd_width * tri(ff[0] + ff[1] * triangle)
y = eve.lcd_height * tri(ff[2] + ff[3] * triangle)
eve.Vertex2f(x, y)
F = [random.random() for i in range(18)]
t = 0
while True:
eve.Clear()
eve.VertexFormat(3)
eve.Begin(eve.LINE_STRIP)
for dt in range(10):
tn = (t - dt) / 75
eve.ColorRGB(
int(255 * tri(F[12] + F[13] * tn)),
int(255 * tri(F[14] + F[15] * tn)),
int(255 * tri(F[16] + F[17] * tn)))
at(tn, F[0:4])
at(tn, F[4:8])
at(tn, F[8:12])
eve.swap()
t += 1