aboutsummaryrefslogtreecommitdiff
path: root/DecayEvent.py
blob: def4284c411032bd2a612be01d67433ead5c1f09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
from PixelEvent import PixelEvent
import Util, math
class DecayEvent(PixelEvent):
    def initEvent(self):
        self.validateArgs('DecayEvent.params')
        self['Coefficient'] = abs(self['Coefficient'])
    def lightState(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)