Skip to content

Commit 4e77616

Browse files
committed
Merge branch 'master' of github.com:lit-illumination-technology/lit_core into master
2 parents a876d66 + 8650d2a commit 4e77616

File tree

2 files changed

+47
-58
lines changed

2 files changed

+47
-58
lines changed

lit/effects/chase.py

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,55 @@
1+
import colorsys
2+
import random
3+
14
name = "Chase"
25

36
start_message = name + " started!"
47

5-
description = "The string is sequentially covered by different colors"
8+
description = (
9+
"The string is sequentially covered by random colors"
10+
)
11+
12+
13+
def create_heads(lights, args):
14+
num_heads = int(args["number"])
15+
colors = [random.random() for _ in range(0, num_heads)]
16+
head_locations = [i * (-lights.size // num_heads) for i in range(0, num_heads)]
17+
return [head_locations, colors]
18+
619

7-
schema = {}
20+
schema = {
21+
"number": {
22+
"value": {
23+
"type": "number", # TODO integer type (or step)
24+
"min": 1,
25+
"max": 20,
26+
"default": 3,
27+
},
28+
"user_input": True,
29+
"required": False,
30+
"index": 0,
31+
},
32+
"color": {
33+
"value": {
34+
"type": "color", # TODO integer type (or step)
35+
"default": {"type": "Random Colors"},
36+
},
37+
"user_input": True,
38+
"required": False,
39+
},
40+
"heads": {
41+
"value": {"type": "tuple list", "default_gen": create_heads},
42+
"user_input": False,
43+
},
44+
}
845

946

1047
def update(lights, step, state):
11-
hue = (0.2 * (step // lights.size)) % 1
12-
lights.set_pixel_hsv(step % lights.size, hue, 1, 1)
48+
heads = state["heads"]
49+
for i in range(len(heads[0])):
50+
if heads[0][i] >= 0:
51+
lights.set_pixel_hsv(heads[0][i], heads[1][i], 1, 1)
52+
heads[0][i] += 1
53+
if heads[0][i] >= lights.size:
54+
heads[0][i] = 0
55+
heads[1][i] = colorsys.rgb_to_hsv(state["color"].get_color(step))

lit/effects/multiChase.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)