Esempio n. 1
0
class KnipperEffect:
    @classmethod
    def definition(cls):
        return EffectDefinition('knipper', ['contour'], [
            BooleanParameter('left_eye'),
            BooleanParameter('right_eye'),
            BooleanParameter('body')])

    def __init__(self, controller, parameters, effectenbak):
        self.controller = controller

        bitmask = 0
        if parameters.get('left_eye'):
            bitmask |= self.controller.contour.LEFT
        if parameters.get('right_eye'):
            bitmask |= self.controller.contour.RIGHT
        if parameters.get('body'):
            bitmask |= self.controller.contour.BODY

        self._bitmask = bitmask
        self._sine = SineWave(upper=50, lower=1, step=0.2)
        self._toggler = Toggle()

    def ticks_per_iteration(self):
        return self._sine.ticks_per_wave()

    def tick(self):
        self.controller.contour.set_state(self._bitmask, self._toggler.next())
        time.sleep(0.001 * self._sine.next())

    def finalize(self):
        self.controller.contour.set_state(self._bitmask, False)
Esempio n. 2
0
    def __init__(self, controller, parameters, effectenbak):
        self.controller = controller

        self._wave = SineWave(255)

        self._duration_aan = float(parameters.get('wave_length'))
        self._a = parameters.get('A')
        self._b = parameters.get('B')
Esempio n. 3
0
    def __init__(self, controller, parameters, effectenbak):
        self.controller = controller

        bitmask = 0
        if parameters.get('left_eye'):
            bitmask |= self.controller.contour.LEFT
        if parameters.get('right_eye'):
            bitmask |= self.controller.contour.RIGHT
        if parameters.get('body'):
            bitmask |= self.controller.contour.BODY

        self._bitmask = bitmask
        self._sine = SineWave(upper=50, lower=1, step=0.2)
        self._toggler = Toggle()
Esempio n. 4
0
class BodyWave:
    @classmethod
    def definition(cls):
        return EffectDefinition('body_wave', ['fader'], [
            BooleanParameter('A'),
            BooleanParameter('B'),
            NumberParameter('wave_length', 60000)
        ])

    def __init__(self, controller, parameters, effectenbak):
        self.controller = controller

        self._wave = SineWave(255)

        self._duration_aan = float(parameters.get('wave_length'))
        self._a = parameters.get('A')
        self._b = parameters.get('B')

    def ticks_per_iteration(self):
        return 255

    def tick(self):
        v = self._wave.next()

        if self._a:
            self.controller.fader.a(v)

        if self._b:
            self.controller.fader.b(v)

        sleep = (float(self._duration_aan) / 255) / 1000
        time.sleep(sleep)

    def finalize(self):
        if self._a:
            self.controller.fader.a(0)

        if self._b:
            self.controller.fader.b(0)