//实现循环更新 private static void UpdateFrameFuncLoop(FrameAnimation frameAnimation) { if (frameAnimation.nCurFrame >= frameAnimation.nLength || frameAnimation.nCurFrame < 0) { frameAnimation.nCurFrame = frameAnimation.nStartFrame; } }
//实现单次更新 private static void UpdateFrameFuncOnce(FrameAnimation frameAnimation) { if (frameAnimation.nCurFrame >= frameAnimation.nLength || frameAnimation.nCurFrame < 0) { frameAnimation.Stop(); if (frameAnimation.iFrameUpdater != null) { frameAnimation.iFrameUpdater.OnComplete(); } } }
//实现来回更新 private static void UpdateFrameFuncPingPong(FrameAnimation frameAnimation) { if (frameAnimation.nSign == 1) { if (frameAnimation.nCurFrame >= frameAnimation.nLength) { frameAnimation.nSign = -1; frameAnimation.nCurFrame -= 2; } } else { if (frameAnimation.nCurFrame < 0) { frameAnimation.nSign = 1; frameAnimation.nCurFrame += 2; } } }