ya2 · news · projects · code · about

182c6e3899a05813461c9c1a793872147ea75a6d
[pmachines.git] / ya2 / lib / p3d / ivals.py
1 from direct.interval.MetaInterval import Sequence
2 from direct.interval.FunctionInterval import Func, Wait
3 from direct.interval.LerpInterval import LerpPosInterval
4
5
6 class P3dSeq:
7
8 def __init__(self, *ivals):
9 self.seq = Sequence(*[ival._ival for ival in ivals])
10 #TODO: don't access a protected member
11
12 def start(self): return self.seq.start()
13
14 def __add__(self, ival):
15 self.seq.append(ival._ival) #TODO: don't access a protected member
16 return self.seq
17
18
19 class P3dWait:
20
21 def __init__(self, time): self._ival = Wait(time)
22
23
24 class P3dPosIval:
25
26 def __init__(self, node, time=1.0, pos=(0, 0, 0), blend_type='ease'):
27 btype = {'ease': 'easeInOut'}[blend_type]
28 self._ival = LerpPosInterval(node, time, pos=pos, blendType=btype)
29
30
31 class P3dFunc:
32
33 def __init__(self, fun, *args): self._ival = Func(fun, *args)