예제 #1
0
    def enterFallForward(self):
        self.notify.debug('enterFallForward')
        if self.isLocal:
            base.playSfx(self.activity.sndOof)
        duration = 2.0
        animName = self.FallFwdAnim
        startFrame = 12
        totalFrames = self.toon.getNumFrames(animName)
        frames = totalFrames - 1 - startFrame
        pauseFrame = 19
        frameRate = self.toon.getFrameRate(animName)
        newRate = frames / (duration * 0.5)
        playRate = newRate / frameRate

        def resume(self=self):
            self.fsm.request('normal')

        self.fallFwdIval = Sequence(
            ActorInterval(self.toon,
                          animName,
                          startTime=startFrame / newRate,
                          endTime=pauseFrame / newRate,
                          playRate=playRate), WaitInterval(duration / 2.0),
            ActorInterval(self.toon,
                          animName,
                          startTime=pauseFrame / newRate,
                          endTime=totalFrames / newRate,
                          playRate=playRate), FunctionInterval(resume))
        self.fallFwdIval.start()
예제 #2
0
    def enterFallBack(self):
        self.notify.debug('enterFallBack')

        if self.isLocal:
            # play 'oof'
            base.playSfx(self.activity.sndOof)

        duration = 1.
        animName = self.FallBackAnim
        startFrame = 12
        totalFrames = self.toon.getNumFrames(animName)
        frames = (totalFrames-1) - startFrame
        frameRate = self.toon.getFrameRate(animName)
        newRate = frames / duration
        playRate = newRate / frameRate

        def resume(self=self):
            self.fsm.request('normal')

        self.fallBackIval = Sequence(
            ActorInterval(self.toon, animName, startTime=startFrame/newRate,
                          endTime=totalFrames/newRate, playRate=playRate),
            FunctionInterval(resume),
            )

        self.fallBackIval.start()