Beispiel #1
0
    def _createEyeFidgetAnimation(self, prevAnim=None):
        if prevAnim is not None:
            morphTargetAtStart = prevAnim.getMorphTargetEnd()
        else:
            morphTargetAtStart = MorphTargetCore({
                'left-eye/white':
                Vector(0, 0),
                'left-eye/black':
                Vector(0, 0),
                'right-eye/white':
                Vector(0, 0),
                'right-eye/black':
                Vector(0, 0)
            })

        eyeTargetOffsetX = random.randrange(-15, 15)
        eyeTargetOffsetY = random.randrange(-15, 5)

        morphTargetAtStop = MorphTargetCore({
            'left-eye/black':
            Vector(eyeTargetOffsetX, eyeTargetOffsetY),
            'left-eye/white':
            Vector(int(eyeTargetOffsetX * 0.8), int(eyeTargetOffsetY * 0.8)),
            'right-eye/black':
            Vector(eyeTargetOffsetX, eyeTargetOffsetY),
            'right-eye/white':
            Vector(int(eyeTargetOffsetX * 0.8), int(eyeTargetOffsetY * 0.8))
        })
        # Pause every x second
        pauseAtStart = random.randrange(self._FPS * 2, self._FPS * 4)
        self._eyeAnimationCtr += 1

        return AnimationCore(morphTargetAtStart, morphTargetAtStop,
                             Config.speedScale(0.03), pauseAtStart)
Beispiel #2
0
    def _createHeadFidgetAnimation(self, prevAnim=None):
        if prevAnim is not None:
            morphTargetAtStart = prevAnim.getMorphTargetEnd()
        else:
            morphTargetAtStart = MorphTargetCore({'frame': Vector(0, 0)},
                                                 {'frame': 0})

        headTargetOffsetY = random.randrange(-5, 4)
        headRotationOffset = random.randrange(-10, 10)
        morphTargetAtStop = MorphTargetCore(
            {'frame': Vector(0, int(headTargetOffsetY))},
            {'frame': headRotationOffset})
        # Pause every x second
        pauseAtStart = random.randrange(self._FPS * 1, self._FPS * 3)
        self._headAnimationCtr += 1

        return AnimationCore(morphTargetAtStart, morphTargetAtStop,
                             Config.speedScale(0.02), pauseAtStart)
Beispiel #3
0
    def _createTailFidgetAnimation(self, prevAnim=None):
        if prevAnim is not None:
            morphTargetAtStart = prevAnim.getMorphTargetEnd()
            morphTargetAtStop = prevAnim.getMorphTargetStart()
        else:
            morphTargetAtStart = MorphTargetCore({'tail': Vector(0, 0)},
                                                 {'tail': 0})
            tailRotationOffset = random.randrange(-30, -20)
            morphTargetAtStop = MorphTargetCore({'tail': Vector(0, 0)},
                                                {'tail': tailRotationOffset})

        pauseAtStart = 0
        if self._tailAnimationCtr % 6 == 0:
            # Pause every x second
            pauseAtStart = random.randrange(self._FPS * 3, self._FPS * 8)

        self._tailAnimationCtr += 1

        return AnimationCore(morphTargetAtStart, morphTargetAtStop,
                             Config.speedScale(0.3), pauseAtStart)
Beispiel #4
0
    def _createRightEarFidgetAnimation(self, prevAnim=None):
        # Alternate moving from start to stop
        if prevAnim is not None:
            morphTargetAtStart = prevAnim.getMorphTargetEnd()
            morphTargetAtStop = prevAnim.getMorphTargetStart()
        else:
            morphTargetAtStart = MorphTargetCore({'right-ear': Vector(0, 0)},
                                                 {'right-ear': 0})
            earTargetOffsetX = random.randrange(-2, 2)
            earTargetOffsetY = random.randrange(20, 30)
            morphTargetAtStop = MorphTargetCore(
                {'right-ear': Vector(earTargetOffsetX, earTargetOffsetY)},
                {'right-ear': 10})

        pauseAtStart = 0
        if self._rightEarAnimationCtr % 4 == 0:
            # Pause every x second
            pauseAtStart = random.randrange(self._FPS * 3, self._FPS * 8)

        self._rightEarAnimationCtr += 1

        return AnimationCore(morphTargetAtStart, morphTargetAtStop,
                             Config.speedScale(0.2), pauseAtStart)
Beispiel #5
0
    def _createLeftArmFidgetAnimation(self, prevAnim=None):
        # Alternate moving from start to stop
        if prevAnim is not None:
            morphTargetAtStart = prevAnim.getMorphTargetEnd()
            morphTargetAtStop = prevAnim.getMorphTargetStart()
        else:
            morphTargetAtStart = MorphTargetCore({'left-arm': Vector(0, 0)},
                                                 {'left-arm': 0})
            earTargetOffsetX = random.randrange(-2, 2)
            earTargetOffsetY = random.randrange(15, 20)
            morphTargetAtStop = MorphTargetCore(
                {'left-arm': Vector(earTargetOffsetX, earTargetOffsetY)},
                {'left-arm': -10})

        pauseAtStart = 0
        if self._leftArmAnimationCtr % 15 == 0:
            # Pause every x second
            pauseAtStart = random.randrange(self._FPS * 3, self._FPS * 8)

        self._leftArmAnimationCtr += 1

        return AnimationCore(morphTargetAtStart, morphTargetAtStop,
                             Config.speedScale(0.05), pauseAtStart)