blob: 4dbe3cdeaf25e54ad2a03a981b60870f931be118 (
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 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)
|