diff options
author | David Lamparter <equinox@diac24.net> | 2016-10-11 01:04:41 +0200 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2016-10-11 01:05:21 +0200 |
commit | 0f47169e66121a1d84d2e1c062f57340ca8e3da6 (patch) | |
tree | b81e9c5294e495ddcef026c3ef04295ee429c186 /dmx/dmxeffects.py | |
parent | dc33ecb0396dd6c747828b663466b04f832aa51b (diff) |
Diffstat (limited to 'dmx/dmxeffects.py')
-rw-r--r-- | dmx/dmxeffects.py | 30 |
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( |