diff --git a/extensions/CCBReader/CCBAnimationManager.cpp b/extensions/CCBReader/CCBAnimationManager.cpp index e475f80f67..5dd93f8049 100644 --- a/extensions/CCBReader/CCBAnimationManager.cpp +++ b/extensions/CCBReader/CCBAnimationManager.cpp @@ -458,10 +458,14 @@ void CCBAnimationManager::setFirstFrame(CCNode *pNode, CCBSequenceProperty *pSeq CCActionInterval* CCBAnimationManager::getEaseAction(CCActionInterval *pAction, int nEasingType, float fEasingOpt) { - if (nEasingType == kCCBKeyframeEasingLinear || nEasingType == kCCBKeyframeEasingInstant) + if (nEasingType == kCCBKeyframeEasingLinear) { return pAction; } + else if (nEasingType == kCCBKeyframeEasingInstant) + { + return CCBEaseInstant::create(pAction); + } else if (nEasingType == kCCBKeyframeEasingCubicIn) { return CCEaseIn::create(pAction, fEasingOpt); @@ -689,6 +693,8 @@ void CCBAnimationManager::sequenceCompleted() } } +// Custom actions + /************************************************************ CCBSetSpriteFrame ************************************************************/ @@ -814,4 +820,35 @@ void CCBRotateTo::update(float time) ; } +/************************************************************ + CCBEaseInstant + ************************************************************/ +CCBEaseInstant* CCBEaseInstant::create(CCActionInterval *pAction) +{ + CCBEaseInstant *pRet = new CCBEaseInstant(); + if (pRet && pRet->initWithAction(pAction)) + { + pRet->autorelease(); + } + else + { + CC_SAFE_RELEASE_NULL(pRet); + } + + return pRet; +} + +void CCBEaseInstant::update(float dt) +{ + if (dt < 0) + { + m_pInner->update(0); + } + else + { + m_pInner->update(1); + } +} + + NS_CC_EXT_END diff --git a/extensions/CCBReader/CCBAnimationManager.h b/extensions/CCBReader/CCBAnimationManager.h index adf22e295b..904d18d924 100644 --- a/extensions/CCBReader/CCBAnimationManager.h +++ b/extensions/CCBReader/CCBAnimationManager.h @@ -143,6 +143,14 @@ public: virtual void startWithTarget(CCNode *pNode); }; +class CCBEaseInstant : public CCActionEase +{ +public: + static CCBEaseInstant* create(CCActionInterval *pAction); + + virtual void update(float dt); +}; + NS_CC_EXT_END #endif // __CCB_CCBANIMATION_MANAGER_H__