aboutsummaryrefslogtreecommitdiff
path: root/pixelevents
diff options
context:
space:
mode:
authorGravatar Russell Cohen <rcoh@mit.edu>2010-11-24 01:09:12 -0500
committerGravatar Russell Cohen <rcoh@mit.edu>2010-11-24 01:09:12 -0500
commitb042647b68abdc82490ca6e059993b8eba28904c (patch)
treea9ee95a38e98b377c251b7b2e9af9cbd8056cf7c /pixelevents
parent407ac922fc4178021cf3a16dfb1bd875b6083ac4 (diff)
Refactoring complete! Made modules/packages as appropriate. Finally.
Diffstat (limited to 'pixelevents')
-rw-r--r--pixelevents/DecayEvent.py12
-rw-r--r--pixelevents/StepEvent.py14
-rw-r--r--pixelevents/__init__.py0
3 files changed, 26 insertions, 0 deletions
diff --git a/pixelevents/DecayEvent.py b/pixelevents/DecayEvent.py
new file mode 100644
index 0000000..c9fc226
--- /dev/null
+++ b/pixelevents/DecayEvent.py
@@ -0,0 +1,12 @@
+from pixelcore import PixelEvent
+import Util, math
+class DecayEvent(PixelEvent):
+ def initEvent(self):
+ self.validateArgs('DecayEvent.params')
+ self['Coefficient'] = abs(self['Coefficient'])
+ def state(self,timeDelay):
+ if self['DecayType'] == 'Exponential':
+ decay = math.exp(timeDelay*-1*self['Coefficient'])
+ if self['DecayType'] == 'Proportional':
+ decay = float(self['Coefficient']) / timeDelay
+ return Util.multiplyColor(self['Color'], decay)
diff --git a/pixelevents/StepEvent.py b/pixelevents/StepEvent.py
new file mode 100644
index 0000000..d95271e
--- /dev/null
+++ b/pixelevents/StepEvent.py
@@ -0,0 +1,14 @@
+from operationscore.PixelEvent import *
+class StepEvent(PixelEvent):
+ def initEvent(self):
+ self.validateArgs('StepEvent.params')
+ def state(self,timeDelay):
+ if timeDelay < self['LightTime'] or self['LightTime'] == -1:
+ return self['Color']
+ else:
+ return None
+ @staticmethod
+ def generate(onTime, color):
+ args = {'LightTime': onTime, 'Color': color}
+ return StepEvent(args)
+
diff --git a/pixelevents/__init__.py b/pixelevents/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pixelevents/__init__.py