aboutsummaryrefslogtreecommitdiff
path: root/pixelevents
diff options
context:
space:
mode:
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}