예제 #1
0
    def __call__( self, duration, var, v1, v2 = None, **params ):
        kw = self.params.copy()
        kw.update( params )

        type = var.type

        now = anim.get(var)
        if kw.has_key('rel') and kw['rel']:
            if v2 is None:
                start, end = now, now+v1
            else:
                start, end = now+v1, now+v2
        else:
            if v2 is None:
                start, end = now, v1
            else:
                start, end = v1, v2

        if not kw.has_key('style'):
            style = _LinearTransition
        else:
            try:
                style = Transition.styles[kw['style']]
            except KeyError:
                raise ValueError, "unknown transition style \"%s\"" % kw['style']

        starttime = anim.current_time()
        interp = style( starttime, duration, start, end, kw, type )
        if duration > 0.0:
            var.add_span( starttime, starttime+duration, interp )
        var.add_span( starttime+duration, None, end )
        anim.advance_clock( duration )
예제 #2
0
    def __call__(self, duration, var, v1, v2=None, **params):
        kw = self.params.copy()
        kw.update(params)

        type = var.type

        now = anim.get(var)
        if kw.has_key('rel') and kw['rel']:
            if v2 is None:
                start, end = now, now + v1
            else:
                start, end = now + v1, now + v2
        else:
            if v2 is None:
                start, end = now, v1
            else:
                start, end = v1, v2

        if not kw.has_key('style'):
            style = _LinearTransition
        else:
            try:
                style = Transition.styles[kw['style']]
            except KeyError:
                raise ValueError, "unknown transition style \"%s\"" % kw[
                    'style']

        starttime = anim.current_time()
        interp = style(starttime, duration, start, end, kw, type)
        if duration > 0.0:
            var.add_span(starttime, starttime + duration, interp)
        var.add_span(starttime + duration, None, end)
        anim.advance_clock(duration)
예제 #3
0
파일: undulate.py 프로젝트: gcross/QC-Talks
    def __call__( self, var, **overridekw ):
        kw = self.params.copy()
        kw.update( overridekw )

        style, period, duration, min, max = self.parse_dictionary( kw )

        starttime = anim.current_time()
        interp = style( starttime, period, min, max )
        if duration is None:
            # run undulator from now until end of time
            var.add_span( starttime, None, interp )
        else:
            # run undulator for finite time and then stop
            var.add_span( starttime, starttime+duration, interp )
            var.add_span( starttime+duration, None, interp(starttime+duration) )
            anim.advance_clock( duration )
예제 #4
0
파일: undulate.py 프로젝트: markovg/slithy
    def __call__(self, var, **overridekw):
        kw = self.params.copy()
        kw.update(overridekw)

        style, period, duration, min, max = self.parse_dictionary(kw)

        starttime = anim.current_time()
        interp = style(starttime, period, min, max)
        if duration is None:
            # run undulator from now until end of time
            var.add_span(starttime, None, interp)
        else:
            # run undulator for finite time and then stop
            var.add_span(starttime, starttime + duration, interp)
            var.add_span(starttime + duration, None,
                         interp(starttime + duration))
            anim.advance_clock(duration)