Skip to content

Commit

Permalink
Merge branch 'master' of github.com:lit-illumination-technology/lit_c…
Browse files Browse the repository at this point in the history
…ore into master
  • Loading branch information
nickpesce committed Dec 6, 2020
2 parents a876d66 + 8650d2a commit 4e77616
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 58 deletions.
51 changes: 47 additions & 4 deletions lit/effects/chase.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,55 @@
import colorsys
import random

name = "Chase"

start_message = name + " started!"

description = "The string is sequentially covered by different colors"
description = (
"The string is sequentially covered by random colors"
)


def create_heads(lights, args):
num_heads = int(args["number"])
colors = [random.random() for _ in range(0, num_heads)]
head_locations = [i * (-lights.size // num_heads) for i in range(0, num_heads)]
return [head_locations, colors]


schema = {}
schema = {
"number": {
"value": {
"type": "number", # TODO integer type (or step)
"min": 1,
"max": 20,
"default": 3,
},
"user_input": True,
"required": False,
"index": 0,
},
"color": {
"value": {
"type": "color", # TODO integer type (or step)
"default": {"type": "Random Colors"},
},
"user_input": True,
"required": False,
},
"heads": {
"value": {"type": "tuple list", "default_gen": create_heads},
"user_input": False,
},
}


def update(lights, step, state):
hue = (0.2 * (step // lights.size)) % 1
lights.set_pixel_hsv(step % lights.size, hue, 1, 1)
heads = state["heads"]
for i in range(len(heads[0])):
if heads[0][i] >= 0:
lights.set_pixel_hsv(heads[0][i], heads[1][i], 1, 1)
heads[0][i] += 1
if heads[0][i] >= lights.size:
heads[0][i] = 0
heads[1][i] = colorsys.rgb_to_hsv(state["color"].get_color(step))
54 changes: 0 additions & 54 deletions lit/effects/multiChase.py

This file was deleted.

0 comments on commit 4e77616

Please sign in to comment.