home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 1.5)
-
- import Bladex
- import ObjStore
-
- class LinearInt:
-
- def __init__(self, init_value, end_value):
- self.init_value = init_value
- self.end_value = end_value
- self.period = end_value - init_value
-
-
- def Execute(self, value):
- return self.init_value + self.period * value
-
-
- def EndExecute(self):
- print 'Ended LinearInt'
-
-
-
- class RGBInt:
-
- def __init__(self, init_value, end_value):
- self.init_value = init_value
- self.end_value = end_value
- self.periodR = end_value[0] - init_value[0]
- self.periodG = end_value[1] - init_value[1]
- self.periodB = end_value[2] - init_value[2]
-
-
- def Execute(self, value):
- return (self.init_value[0] + self.periodR * value, self.init_value[1] + self.periodG * value, self.init_value[2] + self.periodB * value)
-
-
- def EndExecute(self):
- print 'Ended RGBInt'
-
-
-
- class PositionInt:
-
- def __init__(self, init_value, end_value):
- self.init_value = init_value
- self.end_value = end_value
- self.periodX = end_value[0] - init_value[0]
- self.periodY = end_value[1] - init_value[1]
-
-
- def Execute(self, value):
- return (self.init_value[0] + self.periodX * value, self.init_value[1] + self.periodY * value)
-
-
- def EndExecute(self):
- print 'Ended RGBInt'
-
-
-
- class Interp:
-
- def AddAction(self, init_time, end_time, interp_class):
- action = (init_time, end_time, interp_class, end_time - init_time)
- self.Actions.append(action)
- return action
-
-
- def RemoveAction(self, action):
- print 'Trying to remove action:', action
- self.Actions.remove(action)
-
-
- def ExecuteActions(self, time):
- for i in self.Actions:
- end_time = i[1]
- init_time = i[0]
- if time > end_time:
- i[2].EndExecute()
- self.Actions.remove(i)
- elif time > init_time:
- interval_time = i[3]
- value = (time - init_time) / interval_time
- i[2].Execute(value)
-
-
-
-
- def Kill(self):
- Bladex.RemoveAfterFrameFunc('Interp' + self.name)
-
-
- def __init__(self, name):
- self.Actions = []
- self.name = name
- Bladex.SetAfterFrameFunc('Interp' + name, self.ExecuteActions)
- self.ObjId = ObjStore.GetNewId()
- ObjStore.ObjectsStore[self.ObjId] = self
-
-
- def __del__(self):
- self.Kill()
- del ObjStore.ObjectsStore[self.ObjId]
-
-
- def persistent_id(self):
- return self.ObjId
-
-
- def __getstate__(self):
- return (1, self.ObjId, self.Actions, self.name)
-
-
- def __setstate__(self, parm):
- if parm[0] == 1:
- self.ObjId = parm[1]
- ObjStore.ObjectsStore[self.ObjId] = self
- self.Actions = parm[2]
- self.name = parm[3]
- else:
- print 'Warning -> Version mismatch in Interp.__setstate__()'
- self.Actions = []
- self.name = 'UnNamed'
- Bladex.SetAfterFrameFunc('Interp' + name, self.ExecuteActions)
- self.ObjId = ObjStore.GetNewId()
- ObjStore.ObjectsStore[self.ObjId] = self
-
-
-