summaryrefslogtreecommitdiff
path: root/dmx/dmxeffects.py
diff options
context:
space:
mode:
Diffstat (limited to 'dmx/dmxeffects.py')
-rw-r--r--dmx/dmxeffects.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/dmx/dmxeffects.py b/dmx/dmxeffects.py
index ba6c188..5989517 100644
--- a/dmx/dmxeffects.py
+++ b/dmx/dmxeffects.py
@@ -12,7 +12,7 @@ from ola.ClientWrapper import ClientWrapper
wrapper = None
loop_count = 0
TICK_INTERVAL = 10 # in ms
-universenum = 0
+universenum = 2
enable = '--enable' in sys.argv[1:]
@@ -102,6 +102,8 @@ class EffectRGBFadeJump(object):
self.r_phasejump = 0.0
self.r_jumpdecay = 0.0
+ self.hsvmap = lambda arg, h, s, v: (h, s, v)
+
def update(self, timestamp):
curphase = beatsep # int(timestamp)
if self.r_lastphase != curphase:
@@ -113,13 +115,31 @@ class EffectRGBFadeJump(object):
mixcorr = (cos((phase * 3) * 2*pi) - 1. / 2.) * 0.33
- (self.target.r, self.target.g, self.target.b) = \
- colorsys.hsv_to_rgb(phase,
+ h, s, v = (phase,
1.0 - self.r_jumpdecay,
(0.8 + mixcorr) * self.control + self.r_jumpdecay * self.jumpv)
+ h, s, v = self.hsvmap(phase, h, s, v)
+
+ (self.target.r, self.target.g, self.target.b) = \
+ colorsys.hsv_to_rgb(h, s, v)
self.r_jumpdecay *= self.jumpdecayfall
+class EffectStaticHSV(object):
+ def __init__(self, target):
+ self.target = target
+ self.h = 0.0
+ self.s = 0.0
+ self.v = 0.0
+
+ self.r_phasejump = 0.0
+ self.cphase = 0.0
+ self.camount = 0.0
+
+ def update(self, timestamp):
+ (self.target.r, self.target.g, self.target.b) = \
+ colorsys.hsv_to_rgb(self.h, self.s, self.v)
+
class EffectEffectCross(object):
def __init__(self, group, fadespeed = 1./2., phasejump = 0.0):
self.group = group
@@ -153,10 +173,10 @@ universe.append(DMXLEDPAR(21, 0.55))
effects = [
EffectRGBFadeJump(universe[0]),
- EffectRGBFadeJump(universe[1]),
+ EffectStaticHSV(universe[1]),
EffectRGBFadeJump(universe[2]), # , fadespeed = 1./12., phasejump = 0.1),
EffectRGBFadeJump(universe[3]),
- EffectRGBFadeJump(universe[4]),
+ EffectStaticHSV(universe[4]),
]
effects.append(