Added simple effect system

This commit is contained in:
2015-08-28 19:43:07 +02:00
committed by Giovanni Harting
parent 4ad8b85019
commit 43c956c61d
5 changed files with 112 additions and 5 deletions

View File

@@ -0,0 +1,30 @@
from ledd.effects.baseeffect import BaseEffect
from spectra import Color
class GeneratorEffect(BaseEffect):
"""
This is a base class for simple effects.
It should yield a new color on each execution.
"""
def __init__(self):
"""
Do not override, use setup instead.
"""
self.generator = self.execute()
def setup(self):
pass
def execute_internal(self):
c = next(self.generator)
assert isinstance(c, Color)
return c
def execute(self):
pass
def tear_down(self):
pass