コード例 #1
0
        //Interface

        public void PlayAnimation(SimpleAnimation animation)
        {
            //Start playing the given animation from the beginning
            currentAnimation = animation;
            isPlaying        = true;

            //Get the prev/next frames
            //TODO: Handle edge cases with <= 1 keyframe in the animation
            nextFrameIndex = 1;
            nextFrame      = animation.GetKeyframe(nextFrameIndex);
            prevFrame      = animation.GetKeyframe(0);

            //Reset timers
            frameTimer  = 0;
            globalTimer = 0;

            //Apply the first frame
            UpdateTransform();
        }