Exemplo n.º 1
0
    def play(self, obj, pause=1, fade=0, fade_duration=0.5, duration=None):
        if not isinstance(obj, list):
            obj = [obj]

        if len(obj) == 0:
            return

        if fade:
            self.fade_in_start(obj[0], fade_duration)
            if pause:
                anim.pause()

        anim.set(self.anim, obj[0])
        if duration is None:
            d = obj[0].length
        else:
            d = duration
        linear(d, self.t, 0.0, obj[0].length)
        for i in obj[1:]:
            if pause:
                anim.pause()
            anim.set(self.anim, i)
            if duration is None:
                d = i.length
            else:
                d = duration
            linear(d, self.t, 0.0, i.length)

        if fade:
            if pause:
                anim.pause()
            self.fade_out_end(obj[-1], fade_duration)
Exemplo n.º 2
0
    def play( self, obj, pause = 1, fade = 0, fade_duration = 0.5, duration = None ):
        if not isinstance( obj, list ):
            obj = [obj]
            
        if len(obj) == 0:
            return

        if fade:
            self.fade_in_start( obj[0], fade_duration )
            if pause:
                anim.pause()

        anim.set( self.anim, obj[0] )
        if duration is None:
            d = obj[0].length
        else:
            d = duration
        linear( d, self.t, 0.0, obj[0].length )
        for i in obj[1:]:
            if pause:
                anim.pause()
            anim.set( self.anim, i )
            if duration is None:
                d = i.length
            else:
                d = duration
            linear( d, self.t, 0.0, i.length )

        if fade:
            if pause:
                anim.pause()
            self.fade_out_end( obj[-1], fade_duration )
Exemplo n.º 3
0
 def remove_item( self, duration = 0.0, trans = transition.default ):
     if anim.defining_animation():
         before = anim.get( self.items )
         if not before:
             return
         if duration:
             trans( duration, self.show, len(before)-1 )
         anim.set( self.items, before[:-1] )
     else:
         self._startitemlist.pop()
Exemplo n.º 4
0
 def remove_item(self, duration=0.0, trans=transition.default):
     if anim.defining_animation():
         before = anim.get(self.items)
         if not before:
             return
         if duration:
             trans(duration, self.show, len(before) - 1)
         anim.set(self.items, before[:-1])
     else:
         self._startitemlist.pop()
Exemplo n.º 5
0
 def add_item( self, level, text, duration = 0.0, trans = transition.default ):
     if anim.defining_animation():
         before = anim.get( self.items )
         after = before + [(level,text)]
         anim.set( self.items, after )
         if duration:
             trans( duration, self.show, len(after) )
         else:
             anim.set( self.show, len(after) )
     else:
         self._startitemlist.append( (level, text) )
Exemplo n.º 6
0
 def add_item(self, level, text, duration=0.0, trans=transition.default):
     if anim.defining_animation():
         before = anim.get(self.items)
         after = before + [(level, text)]
         anim.set(self.items, after)
         if duration:
             trans(duration, self.show, len(after))
         else:
             anim.set(self.show, len(after))
     else:
         self._startitemlist.append((level, text))
Exemplo n.º 7
0
 def view( self, rect, duration = 0.0, trans = transition.default ):
     if duration <= 0.0:
         anim.set( self.rect, rect )
     else:
         trans( duration, self.rect, rect )
Exemplo n.º 8
0
 def fade_out_end( self, obj, duration ):
     if isinstance( obj, list ):
         obj = obj[-1]
     anim.set( self.anim, obj )
     anim.set( self.t, obj.length )
     linear( duration, self._alpha, 0.0 )
Exemplo n.º 9
0
 def fade_in_start( self, obj, duration ):
     if isinstance( obj, list ):
         obj = obj[0]
     anim.set( self.anim, obj )
     anim.set( self.t, 0.0 )
     linear( duration, self._alpha, 0.0, 1.0 )
Exemplo n.º 10
0
 def clear( self ):
     anim.set( self.anim, None )
Exemplo n.º 11
0
 def show( self, obj, t = 0.0 ):
     if isinstance( obj, list ):
         obj = obj[0]
     print 'showing', obj
     anim.set( self.anim, obj )
     anim.set( self.t, t )
Exemplo n.º 12
0
 def view(self, rect, duration=0.0, trans=transition.default):
     if duration <= 0.0:
         anim.set(self.rect, rect)
     else:
         trans(duration, self.rect, rect)
Exemplo n.º 13
0
 def fade_out_end(self, obj, duration):
     if isinstance(obj, list):
         obj = obj[-1]
     anim.set(self.anim, obj)
     anim.set(self.t, obj.length)
     linear(duration, self._alpha, 0.0)
Exemplo n.º 14
0
 def fade_in_start(self, obj, duration):
     if isinstance(obj, list):
         obj = obj[0]
     anim.set(self.anim, obj)
     anim.set(self.t, 0.0)
     linear(duration, self._alpha, 0.0, 1.0)
Exemplo n.º 15
0
 def clear(self):
     anim.set(self.anim, None)
Exemplo n.º 16
0
 def show(self, obj, t=0.0):
     if isinstance(obj, list):
         obj = obj[0]
     print 'showing', obj
     anim.set(self.anim, obj)
     anim.set(self.t, t)