aboutsummaryrefslogtreecommitdiff
path: root/pixelevents
diff options
context:
space:
mode:
authorGravatar Thomas B Thompson <tbent@spice.(none)>2011-01-04 00:04:05 -0500
committerGravatar Thomas B Thompson <tbent@spice.(none)>2011-01-04 00:04:05 -0500
commit134de4472d3f2fa913944770595de9221dd27fdf (patch)
treecf83e29a1ef4931a15f9b30125fedbd8fba8caf9 /pixelevents
parentf9aeaf10e3c9077504a78374640e79415734546b (diff)
worked on profiling, made a bunch of changes, huge speedup!
Diffstat (limited to 'pixelevents')
-rw-r--r--pixelevents/DecayEvent.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/pixelevents/DecayEvent.py b/pixelevents/DecayEvent.py
index 0b4c820..c1166d6 100644
--- a/pixelevents/DecayEvent.py
+++ b/pixelevents/DecayEvent.py
@@ -3,14 +3,22 @@ import math
from util.ColorOps import *
class DecayEvent(PixelEvent):
def initEvent(self):
- self['Coefficient'] = abs(self['Coefficient'])
- def state(self,timeDelay):
+ self.coefficient = float(abs(self['Coefficient']))
if self['DecayType'] == 'Exponential':
- decay = math.exp(timeDelay*-1*self['Coefficient'])
- if self['DecayType'] == 'Proportional':
- decay = float(self['Coefficient']) / timeDelay
- color = multiplyColor(self['Color'], decay)
- return color if sum(color) > 5 else None
+ self.decayType = 1
+ else:
+ self.decayType = 2
+ self.color = self['Color']
+
+ #SUBVERTING DESIGN FOR THE SAKE OF EFFICIENCY -- RUSSELL COHEN (2011-01-03-23:18)
+ def state(self,timeDelay):
+ if self.decayType == 1:
+ decay = math.exp(timeDelay*-1*self.coefficient)
+ if self.decayType == 2:
+ decay = self.coefficient / timeDelay
+ color = multiplyColor(self.color, decay)
+ return color if (color[0] + color[1] + color[2]) > 5 else None
+
@staticmethod
def generate(decayType, coefficient, color):
args = {'DecayType': decayType, 'Coefficient':coefficient, 'Color':color}