Skip to content

Commit 9086add

Browse files
committed
Dec 19 daily effect, and candycane
1 parent 1d3d2c9 commit 9086add

File tree

4 files changed

+72
-3
lines changed

4 files changed

+72
-3
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '0.1.19'
1+
__version__ = '0.1.20'
22

33
_classifiers = [
44
'Development Status :: 4 - Beta',

xled_plus/samples/candycane.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
Day 11 mod: Candy Cane
3+
Daily effect, December 11 Modified to resemble a Candy Cane pattern
4+
5+
Red and white sweeping diagonally over the lights.
6+
7+
Contributed by gonzotek
8+
"""
9+
10+
from xled_plus.samples.sample_setup import *
11+
12+
ctr = setup_control()
13+
ctr.set_mode("off")
14+
15+
ctr.adjust_layout_aspect(1.0) # How many times wider than high is the led installation?
16+
cols = [hsl_color(0.6226, 1.0, -0.5631), hsl_color(0.6226, 1.0, -0.5631), hsl_color(0.5830, 1.0000, 0.5121), hsl_color(0.6226, 1.0, -0.5631), hsl_color(0.6226, 1.0, -0.5631), hsl_color(0.5830, 1.0000, 0.5121), hsl_color(0.6226, 1.0, -0.5631), hsl_color(0.6226, 1.0, -0.5631), hsl_color(0.5830, 1.0000, 0.5121), hsl_color(0.6030, 1.0000, 0.2121)]
17+
GradientSequence(ctr, cols, speed=0.05, folds=0.8, angle=25).launch_movie()

xled_plus/samples/colmeander.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from .sample_setup import *
22

3-
43
ctr = setup_control()
4+
oldmode = ctr.get_mode()["mode"]
55
eff = ColorMeanderEffect(ctr, "solid")
66
eff.launch_rt()
7+
print("Started continuous effect - press Return to stop it")
78
input()
89
eff.stop_rt()
9-
ctr.turn_off()
10+
ctr.set_mode(oldmode)

xled_plus/samples/day19.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
Day 19 - Rotating Star
3+
4+
A rotating star on a color shifting background (and another star
5+
behind it rotating the other way).
6+
"""
7+
8+
from xled_plus.samples.sample_setup import *
9+
10+
class RotatingStarScene(Scene):
11+
def __init__(self, ctr):
12+
super(RotatingStarScene, self).__init__(ctr)
13+
self.star1c = Star(5, (0, 0), 0.0, 0.25, 0.1, hsl_color(0.38, 1.0, 0.4))
14+
self.star1b = Star(5, (0, 0), 0.0, 0.5, 0.2, hsl_color(0.40, 1.0, 0.2))
15+
self.star1a = Star(5, (0, 0), 0.0, 0.75, 0.3, hsl_color(0.42, 1.0, 0.0))
16+
self.star2 = Star(5, (0, 0), 0.0, 0.75, 0.4, hsl_color(0.48, 1.0, 0.1))
17+
self.star1a.set_torque(24 / self.preferred_fps)
18+
self.star1b.set_torque(24 / self.preferred_fps)
19+
self.star1c.set_torque(24 / self.preferred_fps)
20+
self.star2.set_torque(-24 / self.preferred_fps)
21+
self.star1a.set_depth(1.2)
22+
self.star1b.set_depth(1.1)
23+
self.star1c.set_depth(1.0)
24+
self.star2.set_depth(2)
25+
self.add_shape(self.star1a)
26+
self.add_shape(self.star1b)
27+
self.add_shape(self.star1c)
28+
self.add_shape(self.star2)
29+
30+
def update(self, step):
31+
self.star1a.update(step)
32+
self.star1b.update(step)
33+
self.star1c.update(step)
34+
self.star2.update(step)
35+
36+
def reset(self, numframes):
37+
super(RotatingStarScene, self).reset(numframes)
38+
self.time = 0
39+
40+
def getnext(self):
41+
pat1 = super(RotatingStarScene, self).getnext()
42+
hue = (0.875 + 0.5 * abs(0.5 - (float(self.time) / self.preferred_frames))) % 1.0
43+
patbg = ctr.make_layout_pattern(lambda pos: hsl_color(hue, 1.0, max(0.0, 0.9 - (pos[0]**2+pos[1]**2))), style="centered")
44+
vec = self.getoccupancy()
45+
pat = [pat1[i] if vec[i] else patbg[i] for i in range(self.ctr.num_leds)]
46+
self.time += 1
47+
return pat
48+
49+
ctr = setup_control()
50+
ctr.adjust_layout_aspect(1.0) # How many times wider than high is the led installation?
51+
RotatingStarScene(ctr).launch_movie()

0 commit comments

Comments
 (0)