Cocos2d-x 2.0变速动画深入分析

另:本章所用Cocos2d-x版本为:

最红火的IOS开发群,还有工作推荐哦:

苹果开发群:140554286

手游精英群(IOS):13942819

变速动画都是由时间动画所衍生出来的,它是通过对一个匀速动画的进度进行调节来实现的,所以你要运行一个变速动画,首先要给他指定一个匀速动画,播放这个变速动画,它也播放被指定的匀速动画,在变速动画的更新函数中对被指定的匀速动画通过一个变速曲线计算得到相应的播放进度,变速动画停止播放时,被指定的匀速动画也必须被停止。所以,变速动画其实就是一个控制器,用来控制一个匀速动画的播放进度,使其产生变速的效果。

为了讲述好本节,我专门写了一个曲线生成工具,这样可以更直观的看到变速曲线的形态。有兴趣的可以到我的群里下载这个工具。

打开CActionEase.h:

[cpp] view plaincopy
  1. #ifndef __ACTION_CCEASE_ACTION_H__
  2. #define __ACTION_CCEASE_ACTION_H__
  3. #include "CCActionInterval.h"
  4. //使用Cocos2d命名空间
  5. NS_CC_BEGIN
  6. //要用到以下两个类
  7. class CCObject;
  8. class CCZone;
  9. //所有变速动画的基类。
  10. class CC_DLL CCActionEase : public CCActionInterval
  11. {
  12. public:
  13. //析构
  14. virtual ~CCActionEase(void);
  15. //初始化动画,参数为一个匀速时间动画。
  16. bool initWithAction(CCActionInterval *pAction);
  17. //产生一个当前实例的拷贝。
  18.   virtual CCObject* copyWithZone(CCZone* pZone);
  19.   //指定演示当前动画的演员。
  20.   virtual void startWithTarget(CCNode *pTarget);
  21.   //停止当前动画。
  22.   virtual void stop(void);
  23.   //更新动画。
  24.   virtual void update(float time);
  25.    //创建一个反向播放的当前动画。
  26.    virtual CCActionInterval* reverse(void);
  27. public:
  28. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  29. CC_DEPRECATED_ATTRIBUTE static CCActionEase* actionWithAction(CCActionInterval *pAction);
  30. //同上
  31. static CCActionEase* create(CCActionInterval *pAction);
  32. protected:
  33. //保存对应的匀速动画。
  34. CCActionInterval *m_pOther;
  35. };

对应CPP:

[cpp] view plaincopy
  1. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  2. CCActionEase* CCActionEase::actionWithAction(CCActionInterval *pAction)
  3. {
  4. return CCActionEase::create(pAction);
  5. }
  6. //同上
  7. CCActionEase* CCActionEase::create(CCActionInterval *pAction)
  8. {
  9.   //使用new创建一个当前类实例.
  10. CCActionEase *pRet = new CCActionEase();
  11. if (pRet)
  12.    {
  13.      //初始化.
  14. if (pRet->initWithAction(pAction))
  15. {
  16.    //交由内存管理器进行释放管理.
  17. pRet->autorelease();
  18. }
  19. else
  20. {
  21.    //如果初始化失败,则直接释放
  22. CC_SAFE_RELEASE_NULL(pRet);
  23. }
  24. }
  25.   //返回创建的实例.
  26. return pRet;
  27. }
  28. //初始化.
  29. bool CCActionEase::initWithAction(CCActionInterval *pAction)
  30. {
  31.   //有效性判断.
  32. CCAssert(pAction != NULL, "");
  33.   //先调用基类的初始化函数.
  34. if (CCActionInterval::initWithDuration(pAction->getDuration()))
  35.    {
  36.      //如果成功保存参数动画,本着"占用就加1"的原则,对其引用计数加一.
  37. m_pOther = pAction;
  38. pAction->retain();
  39. return true;
  40. }
  41. return false;
  42. }
  43. //产生一个当前类的实例拷贝.
  44. CCObject* CCActionEase::copyWithZone(CCZone *pZone)
  45. {
  46.   //
  47. CCZone* pNewZone = NULL;
  48. CCActionEase* pCopy = NULL;
  49. //判断参数有效以及其内部已经有创建好的拷贝。
  50.   if(pZone && pZone->m_pCopyObject)
  51. {
  52. //直接强转后返回这个创建好的拷贝。
  53. pCopy = (CCActionEase*)(pZone->m_pCopyObject);
  54. }
  55. else
  56.    {
  57.      //如果无效,新创建一个当前类实例,并创建一个用于拷贝的类实例,将当前类实例设为拷贝类实例的内部拷贝,其实就是建立一个通用的拷贝对象,它内部有一个万物基类CCObject的指针,用来保存各个派生类的实例对象。
  58. pCopy = new CCActionEase();
  59. pZone = pNewZone = new CCZone(pCopy);
  60. }
  61.   //先调用基类的相应函数对其进行基类属性的相关初始化,这个函数会一层层调用当前类基类直至CCAction的相应函数。
  62. CCActionInterval::copyWithZone(pZone);
  63.   //使用保存的匀速动画来初始化拷贝实例。
  64. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  65. //释放通用的拷贝对象。
  66. CC_SAFE_DELETE(pNewZone);
  67. return pCopy;
  68. }
  69. //析构
  70. CCActionEase::~CCActionEase(void)
  71. {
  72.   //释放占用的匀速动画实例。
  73. CC_SAFE_RELEASE(m_pOther);
  74. }
  75. //指定演示当前动画的演员。
  76. void CCActionEase::startWithTarget(CCNode *pTarget)
  77. {
  78.   //调用基类的相应函数。
  79.    CCActionInterval::startWithTarget(pTarget);
  80.    //设定匀速动画的演员。
  81. m_pOther->startWithTarget(m_pTarget);
  82. }
  83. //停止当前动画。
  84. void CCActionEase::stop(void)
  85. {
  86.   //让匀速动画停止播放。
  87.    m_pOther->stop();
  88.    //调用基类的相应函数停止当前动画。
  89. CCActionInterval::stop();
  90. }
  91. //更新动画。
  92. void CCActionEase::update(float time)
  93. {
  94.   //更新匀速动画。
  95. m_pOther->update(time);
  96. }
  97. //创建一个反向播放的变速动画。
  98. CCActionInterval* CCActionEase::reverse(void)
  99. {
  100.   //通过创建一个反向播放的匀速动画做为参数来创建相应的变速动画。
  101. return CCActionEase::create(m_pOther->reverse());
  102. }

上面只是一个基类,它并未真正的提供速度的变化调节,下面还有一个基类,提供了一个速度调节系数值。

[cpp] view plaincopy
  1. //可以设定速度的变速动画基类。
  2. class CC_DLL CCEaseRateAction : public CCActionEase
  3. {
  4. public:
  5. //析构函数。
  6. virtual ~CCEaseRateAction(void);
  7. //设置速度调节系数。
  8. inline void setRate(float rate) { m_fRate = rate; }
  9. //取得速度调节系数。
  10. inline float getRate(void) { return m_fRate; }
  11. //初始化当前动画。
  12. bool initWithAction(CCActionInterval *pAction, float fRate);
  13. //创建一个当前动画的实例拷贝。
  14.    virtual CCObject* copyWithZone(CCZone* pZone);
  15.    //创建一个反向播放的当前动画。
  16. virtual CCActionInterval* reverse(void);
  17. public:
  18. //静态函数:创建对应匀速动画的变速动画,参数一为一个匀速动画。参数二为速度。内部调用create实现。
  19. CC_DEPRECATED_ATTRIBUTE static CCEaseRateAction* actionWithAction(CCActionInterval* pAction, float fRate);
  20. //同上。
  21. static CCEaseRateAction* create(CCActionInterval* pAction, float fRate);
  22. protected:
  23. //保存速度调节系数值。
  24. float m_fRate;
  25. };

CPP实现:

[cpp] view plaincopy
  1. //静态函数:创建对应匀速动画的变速动画,参数一为一个匀速动画。参数二为速度。内部调用create实现。
  2. CCEaseRateAction* CCEaseRateAction::actionWithAction(CCActionInterval *pAction, float fRate)
  3. {
  4. return CCEaseRateAction::create(pAction, fRate);
  5. }
  6. //同上。
  7. CCEaseRateAction* CCEaseRateAction::create(CCActionInterval *pAction, float fRate)
  8. {
  9.   //先创建相应的变速动画。
  10. CCEaseRateAction *pRet = new CCEaseRateAction();
  11. if (pRet)
  12.    {
  13.      //如果成功,进行初始化后交由内存管理器处理。
  14. if (pRet->initWithAction(pAction, fRate))
  15. {
  16. pRet->autorelease();
  17. }
  18. else
  19. {
  20.   //如果失败,释放并置空。
  21. CC_SAFE_RELEASE_NULL(pRet);
  22. }
  23. }
  24. return pRet;
  25. }
  26. //初始化函数。
  27. bool CCEaseRateAction::initWithAction(CCActionInterval *pAction, float fRate)
  28. {
  29.   //调用基类的初始化处理。
  30. if (CCActionEase::initWithAction(pAction))
  31.    {
  32.      //保存速度。
  33. m_fRate = fRate;
  34. return true;
  35. }
  36. return false;
  37. }
  38. //产生一个当前类的实例拷贝。参见基类的解释。
  39. CCObject* CCEaseRateAction::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseRateAction* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseRateAction*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseRateAction();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate);
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //析构
  58. CCEaseRateAction::~CCEaseRateAction(void)
  59. {
  60. }
  61. //创建一个反向播放的变速动画。
  62. CCActionInterval* CCEaseRateAction::reverse(void)
  63. {
  64. return CCEaseRateAction::create(m_pOther->reverse(), 1 / m_fRate);
  65. }

第二个类有了速度属性,但这个速度属性并未对动画起任何作用。后面的类由这个带速度属性的动画基类派生,真正实现相应的变速效果。

[cpp] view plaincopy
  1. //由快变慢的变速动画。
  2. class CC_DLL CCEaseIn : public CCEaseRateAction
  3. {
  4. public:
  5. //更新动画。
  6.    virtual void update(float time);
  7.    //创建一个反向播放的当前动画。
  8.    virtual CCActionInterval* reverse(void);
  9.    //创建一个当前动画的实例拷贝。
  10. virtual CCObject* copyWithZone(CCZone* pZone);
  11. public:
  12.    //静态函数:创建对应匀速动画的变速动画,参数一为一个匀速动画。参数二为速度。内部调用create实现。
  13.      CC_DEPRECATED_ATTRIBUTE static CCEaseIn* actionWithAction(CCActionInterval* pAction, float fRate);
  14. //同上。
  15. static CCEaseIn* create(CCActionInterval* pAction, float fRate);
  16. };

CPP:

[cpp] view plaincopy
  1. //静态函数:创建对应匀速动画的变速动画,参数一为一个匀速动画。参数二为速度。内部调用create实现。
  2. CCEaseIn* CCEaseIn::actionWithAction(CCActionInterval *pAction, float fRate)
  3. {
  4. return CCEaseIn::create(pAction, fRate);
  5. }
  6. //同上,参见CCEaseRateAction的create函数。
  7. CCEaseIn* CCEaseIn::create(CCActionInterval *pAction, float fRate)
  8. {
  9. CCEaseIn *pRet = new CCEaseIn();
  10. if (pRet)
  11. {
  12. if (pRet->initWithAction(pAction, fRate))
  13. {
  14. pRet->autorelease();
  15. }
  16. else
  17. {
  18. CC_SAFE_RELEASE_NULL(pRet);
  19. }
  20. }
  21. return pRet;
  22. }
  23. //产生一个当前类的实例的拷贝,参见CCEaseRateAction的相应函数。
  24. CCObject* CCEaseIn::copyWithZone(CCZone *pZone)
  25. {
  26. CCZone* pNewZone = NULL;
  27. CCEaseIn* pCopy = NULL;
  28. if(pZone && pZone->m_pCopyObject)
  29. {
  30. //in case of being called at sub class
  31. pCopy = (CCEaseIn*)(pZone->m_pCopyObject);
  32. }
  33. else
  34. {
  35. pCopy = new CCEaseIn();
  36. pNewZone = new CCZone(pCopy);
  37. }
  38. pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate);
  39. CC_SAFE_DELETE(pNewZone);
  40. return pCopy;
  41. }
  42. //更新动画。
  43. void CCEaseIn::update(float time)
  44. {
  45.   //这里使用了一个浮点的m_fRate次方计算,time值在0~1间变化,但使用powf(time,m_fRate)会在第一象限生成一个曲线。
  46.    m_pOther->update(powf(time, m_fRate));
  47.    //后面的图把m_fRate在0.1到10之间的曲线表现出来,其中X方向代表的是time,也就是进度,系数值就是m_fRate,红色线代表了powf(time,m_fRate)函数。大家可以看到,在m_fRate小于1时函数是先很短时间内达到接近1之后的增速越来越慢,大于1时函数是开始基本都不递增,到后面增速加快,最后非常快。
  48. }
  49. //创建一个反向播放的变速动画。
  50. CCActionInterval*   CCEaseIn::reverse(void)
  51. {
  52. return       CCEaseIn::create(m_pOther->reverse(),m_fRate);
  53. }

[cpp] view plaincopy
  1. //由慢变快的变速动画,与上个类基个相同,只是在更新函数中速度值不同。
  2. class CC_DLL CCEaseOut : public CCEaseRateAction
  3. {
  4. public:
  5. //更新动画。
  6.    virtual void update(float time);
  7.    //创建一个反向播放的当前动画。
  8.    virtual CCActionInterval* reverse(void);
  9.    //创建一个当前动画的实例拷贝。
  10. virtual CCObject* copyWithZone(CCZone* pZone);
  11. public:
  12.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  13. CC_DEPRECATED_ATTRIBUTE static CCEaseOut* actionWithAction(CCActionInterval* pAction, float fRate);
  14. //同上。
  15. static CCEaseOut* create(CCActionInterval* pAction, float fRate);
  16. };

CPP:

[cpp] view plaincopy
  1. //静态函数:创建对应匀速动画的变速动画,参数一为一个匀速动画。参数二为速度。内部调用create实现。
  2. CCEaseOut* CCEaseOut::actionWithAction(CCActionInterval *pAction, float fRate)
  3. {
  4. return CCEaseOut::create(pAction, fRate);
  5. }
  6. //同上。
  7. CCEaseOut* CCEaseOut::create(CCActionInterval *pAction, float fRate)
  8. {
  9. CCEaseOut *pRet = new CCEaseOut();
  10. if (pRet)
  11. {
  12. if (pRet->initWithAction(pAction, fRate))
  13. {
  14. pRet->autorelease();
  15. }
  16. else
  17. {
  18. CC_SAFE_RELEASE_NULL(pRet);
  19. }
  20. }
  21. return pRet;
  22. }
  23. //产生一个当前类的实例拷贝
  24. CCObject* CCEaseOut::copyWithZone(CCZone *pZone)
  25. {
  26. CCZone* pNewZone = NULL;
  27. CCEaseOut* pCopy = NULL;
  28. if(pZone && pZone->m_pCopyObject)
  29. {
  30. //in case of being called at sub class
  31. pCopy = (CCEaseOut*)(pZone->m_pCopyObject);
  32. }
  33. else
  34. {
  35. pCopy = new CCEaseOut();
  36. pNewZone = new CCZone(pCopy);
  37. }
  38. pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate);
  39. CC_SAFE_DELETE(pNewZone);
  40. return pCopy;
  41. }
  42. //更新函数。
  43. void CCEaseOut::update(float time)
  44. {
  45.   //本动画与上面的动画相似。我也给出曲线图:
  46. m_pOther->update(powf(time, 1 / m_fRate));
  47. }
  48. //创建一个反向播放的变速动画。
  49. CCActionInterval* CCEaseOut::reverse()
  50. {
  51. return CCEaseOut::create(m_pOther->reverse(), 1 / m_fRate);
  52. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseInOut : public CCEaseRateAction
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.   //静态函数:创建对应匀速动画的变速动画,参数一为一个匀速动画。参数二为速度。内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseInOut* actionWithAction(CCActionInterval* pAction, float fRate);
  13. //同上。
  14. static CCEaseInOut* create(CCActionInterval* pAction, float fRate);
  15. };
  16. //静态函数:创建对应匀速动画的变速动画,参数一为一个匀速动画。参数二为速度。内部调用create实现。
  17. CCEaseInOut* CCEaseInOut::actionWithAction(CCActionInterval *pAction, float fRate)
  18. {
  19. return CCEaseInOut::create(pAction, fRate);
  20. }
  21. //同上
  22. CCEaseInOut* CCEaseInOut::create(CCActionInterval *pAction, float fRate)
  23. {
  24. CCEaseInOut *pRet = new CCEaseInOut();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction, fRate))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前类的实例拷贝。
  39. CCObject* CCEaseInOut::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseInOut* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseInOut*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseInOut();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate);
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //更新动画的函数。
  58. void CCEaseInOut::update(float time)
  59. {
  60.   //这个曲线稍复杂,继续上图
  61. time *= 2;
  62. if (time < 1)
  63. {
  64. m_pOther->update(0.5f * powf(time, m_fRate));
  65. }
  66. else
  67. {
  68. m_pOther->update(1.0f - 0.5f * powf(2-time, m_fRate));
  69. }
  70. }
  71. //创建一个反向播放的变速动画。
  72. CCActionInterval* CCEaseInOut::reverse(void)
  73. {
  74. return CCEaseInOut::create(m_pOther->reverse(), m_fRate);
  75. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseExponentialIn : public CCActionEase
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.     //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseExponentialIn* actionWithAction(CCActionInterval* pAction);
  13. //同上。
  14. static CCEaseExponentialIn* create(CCActionInterval* pAction);
  15. };
  16. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  17. CCEaseExponentialIn* CCEaseExponentialIn::actionWithAction(CCActionInterval* pAction)
  18. {
  19. return CCEaseExponentialIn::create(pAction);
  20. }
  21. //同上。
  22. CCEaseExponentialIn* CCEaseExponentialIn::create(CCActionInterval* pAction)
  23. {
  24. CCEaseExponentialIn *pRet = new CCEaseExponentialIn();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前类的实例拷贝。
  39. CCObject* CCEaseExponentialIn::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseExponentialIn* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseExponentialIn*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseExponentialIn();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //更新动画。
  58. void CCEaseExponentialIn::update(float time)
  59. {
  60.   //不废话,上曲线,此曲线没有系数。是固定曲线。
  61. m_pOther->update(time == 0 ? 0 : powf(2, 10 * (time/1 - 1)) - 1 * 0.001f);
  62. }
  63. //创建一个反向播放的变速动画。
  64. CCActionInterval* CCEaseExponentialIn::reverse(void)
  65. {
  66. return CCEaseExponentialOut::create(m_pOther->reverse());
  67. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseExponentialOut : public CCActionEase
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseExponentialOut* actionWithAction(CCActionInterval* pAction);
  13. //同上。
  14. static CCEaseExponentialOut* create(CCActionInterval* pAction);
  15. };
  16. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  17. CCEaseExponentialOut* CCEaseExponentialOut::actionWithAction(CCActionInterval* pAction)
  18. {
  19. return CCEaseExponentialOut::create(pAction);
  20. }
  21. //同上。
  22. CCEaseExponentialOut* CCEaseExponentialOut::create(CCActionInterval* pAction)
  23. {
  24. CCEaseExponentialOut *pRet = new CCEaseExponentialOut();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前动画的实例拷贝。
  39. CCObject* CCEaseExponentialOut::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseExponentialOut* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseExponentialOut*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseExponentialOut();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //更新函数。
  58. void CCEaseExponentialOut::update(float time)
  59. {
  60.   //上曲线说明,此曲线没有系数。是固定曲线。
  61.   
  62. m_pOther->update(time == 1 ? 1 : (-powf(2, -10 * time / 1) + 1));
  63. }
  64. //创建一个反向播放的当前动画。
  65. CCActionInterval* CCEaseExponentialOut::reverse(void)
  66. {
  67. return CCEaseExponentialIn::create(m_pOther->reverse());
  68. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseExponentialInOut : public CCActionEase
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseExponentialInOut* actionWithAction(CCActionInterval* pAction);
  13.    //同上。
  14. static CCEaseExponentialInOut* create(CCActionInterval* pAction);
  15. };
  16. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  17. CCEaseExponentialInOut* CCEaseExponentialInOut::actionWithAction(CCActionInterval *pAction)
  18. {
  19. return CCEaseExponentialInOut::create(pAction);
  20. }
  21. //同上。
  22. CCEaseExponentialInOut* CCEaseExponentialInOut::create(CCActionInterval *pAction)
  23. {
  24. CCEaseExponentialInOut *pRet = new CCEaseExponentialInOut();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前动画的实例拷贝。
  39. CCObject* CCEaseExponentialInOut::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseExponentialInOut* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseExponentialInOut*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseExponentialInOut();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //动画更新。
  58. void CCEaseExponentialInOut::update(float time)
  59. {
  60.   //上曲线,没有系数,固定曲线
  61.   
  62. time /= 0.5f;
  63. if (time < 1)
  64. {
  65. time = 0.5f * powf(2, 10 * (time - 1));
  66. }
  67. else
  68. {
  69. time = 0.5f * (-powf(2, -10 * (time - 1)) + 2);
  70. }
  71. m_pOther->update(time);
  72. }
  73. //创建一个反向播放的当前动画。
  74. CCActionInterval* CCEaseExponentialInOut::reverse()
  75. {
  76. return CCEaseExponentialInOut::create(m_pOther->reverse());
  77. }

[cpp] view plaincopy
  1. //cos曲线方式变化的变速动画。
  2. class CC_DLL CCEaseSineIn : public CCActionEase
  3. {
  4. public:
  5. //更新动画。
  6.    virtual void update(float time);
  7.    //创建一个反向播放的当前动画。
  8.    virtual CCActionInterval* reverse(void);
  9.    //创建一个当前动画的实例拷贝。
  10. virtual CCObject* copyWithZone(CCZone* pZone);
  11. public:
  12.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  13. CC_DEPRECATED_ATTRIBUTE static CCEaseSineIn* actionWithAction(CCActionInterval* pAction);
  14. //同上
  15. static CCEaseSineIn* create(CCActionInterval* pAction);
  16. };
  17. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  18. CCEaseSineIn* CCEaseSineIn::actionWithAction(CCActionInterval* pAction)
  19. {
  20. return CCEaseSineIn::create(pAction);
  21. }
  22. //同上
  23. CCEaseSineIn* CCEaseSineIn::create(CCActionInterval* pAction)
  24. {
  25. CCEaseSineIn *pRet = new CCEaseSineIn();
  26. if (pRet)
  27. {
  28. if (pRet->initWithAction(pAction))
  29. {
  30. pRet->autorelease();
  31. }
  32. else
  33. {
  34. CC_SAFE_RELEASE_NULL(pRet);
  35. }
  36. }
  37. return pRet;
  38. }
  39. //创建一个当前动画的实例拷贝。
  40. CCObject* CCEaseSineIn::copyWithZone(CCZone *pZone)
  41. {
  42. CCZone* pNewZone = NULL;
  43. CCEaseSineIn* pCopy = NULL;
  44. if(pZone && pZone->m_pCopyObject)
  45. {
  46. //in case of being called at sub class
  47. pCopy = (CCEaseSineIn*)(pZone->m_pCopyObject);
  48. }
  49. else
  50. {
  51. pCopy = new CCEaseSineIn();
  52. pNewZone = new CCZone(pCopy);
  53. }
  54. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  55. CC_SAFE_DELETE(pNewZone);
  56. return pCopy;
  57. }
  58. //更新
  59. void CCEaseSineIn::update(float time)
  60. {   //上曲线图,无需参数,固定曲线:
  61.   
  62. m_pOther->update(-1 * cosf(time * (float)M_PI_2) + 1);
  63. }
  64. //创建一个反向播放的当前动画。
  65. CCActionInterval* CCEaseSineIn::reverse(void)
  66. {
  67. return CCEaseSineOut::create(m_pOther->reverse());
  68. }

[cpp] view plaincopy
  1. //sin曲线方式变化的变速动画。
  2. class CC_DLL CCEaseSineOut : public CCActionEase
  3. {
  4. public:
  5. //更新动画。
  6.    virtual void update(float time);
  7.    //创建一个反向播放的当前动画。
  8.    virtual CCActionInterval* reverse(void);
  9.    //创建一个当前动画的实例拷贝。
  10. virtual CCObject* copyWithZone(CCZone* pZone);
  11. public:
  12.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  13. CC_DEPRECATED_ATTRIBUTE static CCEaseSineOut* actionWithAction(CCActionInterval* pAction);
  14. //同上
  15. static CCEaseSineOut* create(CCActionInterval* pAction);
  16. };
  17. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  18. CCEaseSineOut* CCEaseSineOut::actionWithAction(CCActionInterval* pAction)
  19. {
  20. return CCEaseSineOut::create(pAction);
  21. }
  22. //同上
  23. CCEaseSineOut* CCEaseSineOut::create(CCActionInterval* pAction)
  24. {
  25. CCEaseSineOut *pRet = new CCEaseSineOut();
  26. if (pRet)
  27. {
  28. if (pRet->initWithAction(pAction))
  29. {
  30. pRet->autorelease();
  31. }
  32. else
  33. {
  34. CC_SAFE_RELEASE_NULL(pRet);
  35. }
  36. }
  37. return pRet;
  38. }
  39. //创建一个当前动画的实例拷贝。
  40. CCObject* CCEaseSineOut::copyWithZone(CCZone *pZone)
  41. {
  42. CCZone* pNewZone = NULL;
  43. CCEaseSineOut* pCopy = NULL;
  44. if(pZone && pZone->m_pCopyObject)
  45. {
  46. //in case of being called at sub class
  47. pCopy = (CCEaseSineOut*)(pZone->m_pCopyObject);
  48. }
  49. else
  50. {
  51. pCopy = new CCEaseSineOut();
  52. pNewZone = new CCZone(pCopy);
  53. }
  54. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  55. CC_SAFE_DELETE(pNewZone);
  56. return pCopy;
  57. }
  58. //更新
  59. void CCEaseSineOut::update(float time)
  60. {
  61.   //上图说明:
  62.   
  63. m_pOther->update(sinf(time * (float)M_PI_2));
  64. }
  65. //创建一个反向播放的当前动画。
  66. CCActionInterval* CCEaseSineOut::reverse(void)
  67. {
  68. return CCEaseSineIn::create(m_pOther->reverse());
  69. }

[cpp] view plaincopy
  1. //另种cos曲线方式变化的变速动画。
  2. class CC_DLL CCEaseSineInOut : public CCActionEase
  3. {
  4. public:
  5. //更新动画。
  6.    virtual void update(float time);
  7.    //创建一个反向播放的当前动画。
  8.    virtual CCActionInterval* reverse(void);
  9.    //创建一个当前动画的实例拷贝。
  10. virtual CCObject* copyWithZone(CCZone* pZone);
  11. public:
  12.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  13. CC_DEPRECATED_ATTRIBUTE static CCEaseSineInOut* actionWithAction(CCActionInterval* pAction);
  14.    //同上
  15. static CCEaseSineInOut* create(CCActionInterval* pAction);
  16. };
  17. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  18. CCEaseSineInOut* CCEaseSineInOut::actionWithAction(CCActionInterval* pAction)
  19. {
  20. return CCEaseSineInOut::create(pAction);
  21. }
  22. //同上
  23. CCEaseSineInOut* CCEaseSineInOut::create(CCActionInterval* pAction)
  24. {
  25. CCEaseSineInOut *pRet = new CCEaseSineInOut();
  26. if (pRet)
  27. {
  28. if (pRet->initWithAction(pAction))
  29. {
  30. pRet->autorelease();
  31. }
  32. else
  33. {
  34. CC_SAFE_RELEASE_NULL(pRet);
  35. }
  36. }
  37. return pRet;
  38. }
  39. //创建一个当前动画的实例拷贝。
  40. CCObject* CCEaseSineInOut::copyWithZone(CCZone *pZone)
  41. {
  42. CCZone* pNewZone = NULL;
  43. CCEaseSineInOut* pCopy = NULL;
  44. if(pZone && pZone->m_pCopyObject)
  45. {
  46. //in case of being called at sub class
  47. pCopy = (CCEaseSineInOut*)(pZone->m_pCopyObject);
  48. }
  49. else
  50. {
  51. pCopy = new CCEaseSineInOut();
  52. pNewZone = new CCZone(pCopy);
  53. }
  54. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  55. CC_SAFE_DELETE(pNewZone);
  56. return pCopy;
  57. }
  58. //更新函数。
  59. void CCEaseSineInOut::update(float time)
  60. {
  61.   //上曲线说明:
  62. m_pOther->update(-0.5f * (cosf((float)M_PI * time) - 1));
  63. }
  64. //创建一个反向播放的当前动画。
  65. CCActionInterval* CCEaseSineInOut::reverse()
  66. {
  67. return CCEaseSineInOut::create(m_pOther->reverse());
  68. }

[cpp] view plaincopy
  1. //一个基类,用于衍生后面的变速动画。
  2. class CC_DLL CCEaseElastic : public CCActionEase
  3. {
  4. public:
  5. //取得系数
  6. inline float getPeriod(void) { return m_fPeriod; }
  7.    //设置系数
  8. inline void setPeriod(float fPeriod) { m_fPeriod = fPeriod; }
  9. //初始化函数。
  10. bool initWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
  11.   //创建一个反向播放的当前动画。
  12.    virtual CCActionInterval* reverse(void);
  13.    
  14.   //创建一个当前动画的实例拷贝。
  15. virtual CCObject* copyWithZone(CCZone* pZone);
  16. public:
  17. //静态函数:创建对应匀速动画的变速动画,参数一为一个匀速动画。参数二为系数。内部调用create实现。
  18. CC_DEPRECATED_ATTRIBUTE static CCEaseElastic* actionWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
  19. //同上
  20. static CCEaseElastic* create(CCActionInterval *pAction, float fPeriod = 0.3f);
  21. protected:
  22.    //曲线系数。
  23. float m_fPeriod;
  24. };
  25. //静态函数:创建对应匀速动画的变速动画,参数一为一个匀速动画。参数二为系数。内部调用create实现。
  26. CCEaseElastic* CCEaseElastic::actionWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
  27. {
  28. return CCEaseElastic::create(pAction, fPeriod);
  29. }
  30. //同上
  31. CCEaseElastic* CCEaseElastic::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
  32. {
  33. CCEaseElastic *pRet = new CCEaseElastic();
  34. if (pRet)
  35. {
  36. if (pRet->initWithAction(pAction, fPeriod))
  37. {
  38. pRet->autorelease();
  39. }
  40. else
  41. {
  42. CC_SAFE_RELEASE_NULL(pRet);
  43. }
  44. }
  45. return pRet;
  46. }
  47. //初始化函数。
  48. bool CCEaseElastic::initWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
  49. {
  50. if (CCActionEase::initWithAction(pAction))
  51.    {
  52.      //保存曲线系数。
  53. m_fPeriod = fPeriod;
  54. return true;
  55. }
  56. return false;
  57. }
  58.   
  59. //创建一个当前动画的实例拷贝。
  60. CCObject* CCEaseElastic::copyWithZone(CCZone *pZone)
  61. {
  62. CCZone* pNewZone = NULL;
  63. CCEaseElastic* pCopy = NULL;
  64. if(pZone && pZone->m_pCopyObject)
  65. {
  66. //in case of being called at sub class
  67. pCopy = (CCEaseElastic*)(pZone->m_pCopyObject);
  68. }
  69. else
  70. {
  71. pCopy = new CCEaseElastic();
  72. pNewZone = new CCZone(pCopy);
  73. }
  74. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod);
  75. CC_SAFE_DELETE(pNewZone);
  76. return pCopy;
  77. }
  78. //创建一个反向播放的当前动画。
  79. CCActionInterval* CCEaseElastic::reverse(void)
  80. {
  81. CCAssert(0, "Override me");
  82. return NULL;
  83. }
[cpp] view plaincopy
  1. //上面基类衍生的新类。
  2. class CC_DLL CCEaseElasticIn : public CCEaseElastic
  3. {
  4. public:
  5. //更新动画。
  6.    virtual void update(float time);
  7.    //创建一个反向播放的当前动画。
  8.    virtual CCActionInterval* reverse(void);
  9.    //创建一个当前动画的实例拷贝。
  10. virtual CCObject* copyWithZone(CCZone* pZone);
  11. public:
  12.    //静态函数:创建对应匀速动画的变速动画,第一参数为一个匀速动画。第二参数为曲线系数,内部调用create实现。
  13. CC_DEPRECATED_ATTRIBUTE static CCEaseElasticIn* actionWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
  14. //同上。
  15. static CCEaseElasticIn* create(CCActionInterval *pAction, float fPeriod = 0.3f);
  16. };
  17. //静态函数:创建对应匀速动画的变速动画,第一参数为一个匀速动画。第二参数为曲线系数,内部调用create实现。
  18. CCEaseElasticIn* CCEaseElasticIn::actionWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
  19. {
  20. return CCEaseElasticIn::create(pAction, fPeriod);
  21. }
  22. //同上。
  23. CCEaseElasticIn* CCEaseElasticIn::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
  24. {
  25. CCEaseElasticIn *pRet = new CCEaseElasticIn();
  26. if (pRet)
  27. {
  28. if (pRet->initWithAction(pAction, fPeriod))
  29. {
  30. pRet->autorelease();
  31. }
  32. else
  33. {
  34. CC_SAFE_RELEASE_NULL(pRet);
  35. }
  36. }
  37. return pRet;
  38. }
  39. //创建一个当前动画的实例拷贝。
  40. CCObject* CCEaseElasticIn::copyWithZone(CCZone *pZone)
  41. {
  42. CCZone* pNewZone = NULL;
  43. CCEaseElasticIn* pCopy = NULL;
  44. if(pZone && pZone->m_pCopyObject)
  45. {
  46. //in case of being called at sub class
  47. pCopy = (CCEaseElasticIn*)(pZone->m_pCopyObject);
  48. }
  49. else
  50. {
  51. pCopy = new CCEaseElasticIn();
  52. pNewZone = new CCZone(pCopy);
  53. }
  54. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod);
  55. CC_SAFE_DELETE(pNewZone);
  56. return pCopy;
  57. }
  58. //更新动画。
  59. void CCEaseElasticIn::update(float time)
  60. {
  61.   //比较复杂,上图说明在不同的系数时的曲线结果:
  62.   
  63. float newT = 0;
  64. if (time == 0 || time == 1)
  65. {
  66. newT = time;
  67. }
  68. else
  69. {
  70. float s = m_fPeriod / 4;
  71. time = time - 1;
  72. newT = -powf(2, 10 * time) * sinf((time - s) * M_PI_X_2 / m_fPeriod);
  73. }
  74. m_pOther->update(newT);
  75. }
  76. //创建一个反向播放的当前动画。
  77. CCActionInterval* CCEaseElasticIn::reverse(void)
  78. {
  79. return CCEaseElasticOut::create(m_pOther->reverse(), m_fPeriod);
  80. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseElasticOut : public CCEaseElastic
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.    //静态函数:创建对应匀速动画的变速动画,第一参数为一个匀速动画。第二参数为曲线系数,内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseElasticOut* actionWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
  13. //同上
  14. static CCEaseElasticOut* create(CCActionInterval *pAction, float fPeriod = 0.3f);
  15. };
  16.    //静态函数:创建对应匀速动画的变速动画,第一参数为一个匀速动画。第二参数为曲线系数,内部调用create实现。
  17. CCEaseElasticOut* CCEaseElasticOut::actionWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
  18. {
  19. return CCEaseElasticOut::create(pAction, fPeriod);
  20. }
  21. //同上
  22. CCEaseElasticOut* CCEaseElasticOut::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
  23. {
  24. CCEaseElasticOut *pRet = new CCEaseElasticOut();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction, fPeriod))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前动画的实例拷贝。
  39. CCObject *CCEaseElasticOut::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseElasticOut* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseElasticOut*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseElasticOut();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod);
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //更新动画。
  58. void CCEaseElasticOut::update(float time)
  59. {
  60.   //继续上曲线说明:
  61.   
  62. float newT = 0;
  63. if (time == 0 || time == 1)
  64. {
  65. newT = time;
  66. }
  67. else
  68. {
  69. float s = m_fPeriod / 4;
  70. newT = powf(2, -10 * time) * sinf((time - s) * M_PI_X_2 / m_fPeriod) + 1;
  71. }
  72. m_pOther->update(newT);
  73. }
  74. //创建一个反向播放的当前动画。
  75. CCActionInterval* CCEaseElasticOut::reverse(void)
  76. {
  77. return CCEaseElasticIn::create(m_pOther->reverse(), m_fPeriod);
  78. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseElasticInOut : public CCEaseElastic
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.    //静态函数:创建对应匀速动画的变速动画,第一参数为一个匀速动画。第二参数为曲线系数,内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseElasticInOut* actionWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
  13. //同上
  14. static CCEaseElasticInOut* create(CCActionInterval *pAction, float fPeriod = 0.3f);
  15. };
  16. //静态函数:创建对应匀速动画的变速动画,第一参数为一个匀速动画。第二参数为曲线系数,内部调用create实现。
  17. CCEaseElasticInOut* CCEaseElasticInOut::actionWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
  18. {
  19. return CCEaseElasticInOut::create(pAction, fPeriod);
  20. }
  21. //同上
  22. CCEaseElasticInOut* CCEaseElasticInOut::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
  23. {
  24. CCEaseElasticInOut *pRet = new CCEaseElasticInOut();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction, fPeriod))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前动画的实例拷贝。
  39. CCObject* CCEaseElasticInOut::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseElasticInOut* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseElasticInOut*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseElasticInOut();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod);
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //更新动画。
  58. void CCEaseElasticInOut::update(float time)
  59. {
  60.   //挺复杂的曲线:
  61.   
  62. float newT = 0;
  63. if (time == 0 || time == 1)
  64. {
  65. newT = time;
  66. }
  67. else
  68. {
  69. time = time * 2;
  70. if (! m_fPeriod)
  71. {
  72. m_fPeriod = 0.3f * 1.5f;
  73. }
  74. float s = m_fPeriod / 4;
  75. time = time - 1;
  76. if (time < 0)
  77. {
  78. newT = -0.5f * powf(2, 10 * time) * sinf((time -s) * M_PI_X_2 / m_fPeriod);
  79. }
  80. else
  81. {
  82. newT = powf(2, -10 * time) * sinf((time - s) * M_PI_X_2 / m_fPeriod) * 0.5f + 1;
  83. }
  84. }
  85. m_pOther->update(newT);
  86. }
  87. //创建一个反向播放的当前动画。
  88. CCActionInterval* CCEaseElasticInOut::reverse(void)
  89. {
  90. return CCEaseElasticInOut::create(m_pOther->reverse(), m_fPeriod);
  91. }

[cpp] view plaincopy
  1. //又是一个变速动画的基类,用于衍生一些复杂的变速曲线。
  2. class CC_DLL CCEaseBounce : public CCActionEase
  3. {
  4. public:
  5.   //计算曲线处理
  6.    float bounceTime(float time);
  7.    //产生一个当前类的实例拷贝。
  8.    virtual CCObject* copyWithZone(CCZone* pZone);
  9.    //创建一个反向播放的当前动画
  10. virtual CCActionInterval* reverse();
  11. public:
  12.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  13. CC_DEPRECATED_ATTRIBUTE static CCEaseBounce* actionWithAction(CCActionInterval* pAction);
  14. //同上。
  15. static CCEaseBounce* create(CCActionInterval* pAction);
  16. };
  17.    
  18. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  19. CCEaseBounce* CCEaseBounce::actionWithAction(CCActionInterval* pAction)
  20. {
  21. return CCEaseBounce::create(pAction);
  22. }
  23. //同上。
  24. CCEaseBounce* CCEaseBounce::create(CCActionInterval* pAction)
  25. {
  26. CCEaseBounce *pRet = new CCEaseBounce();
  27. if (pRet)
  28. {
  29. if (pRet->initWithAction(pAction))
  30. {
  31. pRet->autorelease();
  32. }
  33. else
  34. {
  35. CC_SAFE_RELEASE_NULL(pRet);
  36. }
  37. }
  38. return pRet;
  39. }
  40. //产生一个当前类的实例拷贝。
  41. CCObject* CCEaseBounce::copyWithZone(CCZone *pZone)
  42. {
  43. CCZone* pNewZone = NULL;
  44. CCEaseBounce* pCopy = NULL;
  45. if(pZone && pZone->m_pCopyObject)
  46. {
  47. //in case of being called at sub class
  48. pCopy = (CCEaseBounce*)(pZone->m_pCopyObject);
  49. }
  50. else
  51. {
  52. pCopy = new CCEaseBounce();
  53. pNewZone = new CCZone(pCopy);
  54. }
  55. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  56. CC_SAFE_DELETE(pNewZone);
  57. return pCopy;
  58. }
  59. //计算曲线处理
  60. float CCEaseBounce::bounceTime(float time)
  61. {
  62.   //复杂曲线说明:
  63.   
  64. if (time < 1 / 2.75)
  65. {
  66. return 7.5625f * time * time;
  67. } else
  68. if (time < 2 / 2.75)
  69. {
  70. time -= 1.5f / 2.75f;
  71. return 7.5625f * time * time + 0.75f;
  72. } else
  73. if(time < 2.5 / 2.75)
  74. {
  75. time -= 2.25f / 2.75f;
  76. return 7.5625f * time * time + 0.9375f;
  77. }
  78. time -= 2.625f / 2.75f;
  79. return 7.5625f * time * time + 0.984375f;
  80. }
  81. //创建一个反向播放的当前动画
  82. CCActionInterval* CCEaseBounce::reverse()
  83. {
  84. return CCEaseBounce::create(m_pOther->reverse());
  85. }
[cpp] view plaincopy
  1. //上面类的衍生类。
  2. class CC_DLL CCEaseBounceIn : public CCEaseBounce
  3. {
  4. public:
  5. //更新动画。
  6.    virtual void update(float time);
  7.    //创建一个反向播放的当前动画。
  8.    virtual CCActionInterval* reverse(void);
  9.    //创建一个当前动画的实例拷贝。
  10. virtual CCObject* copyWithZone(CCZone* pZone);
  11. public:
  12.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  13. CC_DEPRECATED_ATTRIBUTE static CCEaseBounceIn* actionWithAction(CCActionInterval* pAction);
  14. //同上。
  15. static CCEaseBounceIn* create(CCActionInterval* pAction);
  16. };
  17. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  18. CCEaseBounceIn* CCEaseBounceIn::actionWithAction(CCActionInterval* pAction)
  19. {
  20. return CCEaseBounceIn::create(pAction);
  21. }
  22. //同上。
  23. CCEaseBounceIn* CCEaseBounceIn::create(CCActionInterval* pAction)
  24. {
  25. CCEaseBounceIn *pRet = new CCEaseBounceIn();
  26. if (pRet)
  27. {
  28. if (pRet->initWithAction(pAction))
  29. {
  30. pRet->autorelease();
  31. }
  32. else
  33. {
  34. CC_SAFE_RELEASE_NULL(pRet);
  35. }
  36. }
  37. return pRet;
  38. }
  39. //创建一个当前动画的实例拷贝。
  40. CCObject* CCEaseBounceIn::copyWithZone(CCZone *pZone)
  41. {
  42. CCZone* pNewZone = NULL;
  43. CCEaseBounceIn* pCopy = NULL;
  44. if(pZone && pZone->m_pCopyObject)
  45. {
  46. //in case of being called at sub class
  47. pCopy = (CCEaseBounceIn*)(pZone->m_pCopyObject);
  48. }
  49. else
  50. {
  51. pCopy = new CCEaseBounceIn();
  52. pNewZone = new CCZone(pCopy);
  53. }
  54. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  55. CC_SAFE_DELETE(pNewZone);
  56. return pCopy;
  57. }
  58. //更新动画。
  59. void CCEaseBounceIn::update(float time)
  60. {
  61.   //先计算出变速曲线的结果然后做为进度值设置给匀速动画。
  62.   //曲线未设系数,为固定曲线。
  63.   
  64. float newT = 1 - bounceTime(1 - time);
  65. m_pOther->update(newT);
  66. }
  67. //创建一个反向播放的当前动画。
  68. CCActionInterval* CCEaseBounceIn::reverse(void)
  69. {
  70. return CCEaseBounceOut::create(m_pOther->reverse());
  71. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseBounceOut : public CCEaseBounce
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseBounceOut* actionWithAction(CCActionInterval* pAction);
  13. //同上
  14. static CCEaseBounceOut* create(CCActionInterval* pAction);
  15. };
  16. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  17. CCEaseBounceOut* CCEaseBounceOut::actionWithAction(CCActionInterval* pAction)
  18. {
  19. return CCEaseBounceOut::create(pAction);
  20. }
  21. //同上
  22. CCEaseBounceOut* CCEaseBounceOut::create(CCActionInterval* pAction)
  23. {
  24. CCEaseBounceOut *pRet = new CCEaseBounceOut();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前动画的实例拷贝。
  39. CCObject* CCEaseBounceOut::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseBounceOut* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseBounceOut*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseBounceOut();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //更新动画
  58. void CCEaseBounceOut::update(float time)
  59. {
  60.   //曲线说明:
  61.   //曲线未设系数,为固定曲线。
  62.   
  63. float newT = bounceTime(time);
  64. m_pOther->update(newT);
  65. }
  66. //创建一个反向播放的当前动画。
  67. CCActionInterval* CCEaseBounceOut::reverse(void)
  68. {
  69. return CCEaseBounceIn::create(m_pOther->reverse());
  70. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseBounceInOut : public CCEaseBounce
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseBounceInOut* actionWithAction(CCActionInterval* pAction);
  13. //同上
  14. static CCEaseBounceInOut* create(CCActionInterval* pAction);
  15. };
  16.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  17. CCEaseBounceInOut* CCEaseBounceInOut::actionWithAction(CCActionInterval* pAction)
  18. {
  19. return CCEaseBounceInOut::create(pAction);
  20. }
  21. //同上
  22. CCEaseBounceInOut* CCEaseBounceInOut::create(CCActionInterval* pAction)
  23. {
  24. CCEaseBounceInOut *pRet = new CCEaseBounceInOut();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前动画的实例拷贝。
  39. CCObject* CCEaseBounceInOut::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseBounceInOut* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseBounceInOut*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseBounceInOut();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //动画更新
  58. void CCEaseBounceInOut::update(float time)
  59. {
  60.   //曲线说明:
  61.   
  62. float newT = 0;
  63. if (time < 0.5f)
  64. {
  65. time = time * 2;
  66. newT = (1 - bounceTime(1 - time)) * 0.5f;
  67. }
  68. else
  69. {
  70. newT = bounceTime(time * 2 - 1) * 0.5f + 0.5f;
  71. }
  72. m_pOther->update(newT);
  73. }
  74. //创建一个反向播放的当前动画。
  75. CCActionInterval* CCEaseBounceInOut::reverse()
  76. {
  77. return CCEaseBounceInOut::create(m_pOther->reverse());
  78. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseBackIn : public CCActionEase
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseBackIn* actionWithAction(CCActionInterval* pAction);
  13. //同上
  14. static CCEaseBackIn* create(CCActionInterval* pAction);
  15. };
  16. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  17. CCEaseBackIn* CCEaseBackIn::actionWithAction(CCActionInterval *pAction)
  18. {
  19. return CCEaseBackIn::create(pAction);
  20. }
  21. //同上
  22. CCEaseBackIn* CCEaseBackIn::create(CCActionInterval *pAction)
  23. {
  24. CCEaseBackIn *pRet = new CCEaseBackIn();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前动画的实例拷贝。
  39. CCObject* CCEaseBackIn::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseBackIn* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseBackIn*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseBackIn();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //更新动画.
  58. void CCEaseBackIn::update(float time)
  59. {
  60.   //菜花,上曲线!
  61.   
  62. float overshoot = 1.70158f;
  63. m_pOther->update(time * time * ((overshoot + 1) * time - overshoot));
  64. }
  65. //创建一个反向播放的当前动画。
  66. CCActionInterval* CCEaseBackIn::reverse(void)
  67. {
  68. return CCEaseBackOut::create(m_pOther->reverse());
  69. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseBackOut : public CCActionEase
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseBackOut* actionWithAction(CCActionInterval* pAction);
  13. //同上
  14. static CCEaseBackOut* create(CCActionInterval* pAction);
  15. };
  16. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  17. CCEaseBackOut* CCEaseBackOut::actionWithAction(CCActionInterval* pAction)
  18. {
  19. return CCEaseBackOut::create(pAction);
  20. }
  21. //同上
  22. CCEaseBackOut* CCEaseBackOut::create(CCActionInterval* pAction)
  23. {
  24. CCEaseBackOut *pRet = new CCEaseBackOut();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前动画的实例拷贝。
  39. CCObject* CCEaseBackOut::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseBackOut* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseBackOut*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseBackOut();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //更新动画.
  58. void CCEaseBackOut::update(float time)
  59. {
  60.   //奶妈,上曲线!
  61.   
  62. float overshoot = 1.70158f;
  63. time = time - 1;
  64. m_pOther->update(time * time * ((overshoot + 1) * time + overshoot) + 1);
  65. }
  66. //创建一个反向播放的当前动画。
  67. CCActionInterval* CCEaseBackOut::reverse(void)
  68. {
  69. return CCEaseBackIn::create(m_pOther->reverse());
  70. }

[cpp] view plaincopy
  1. class CC_DLL CCEaseBackInOut : public CCActionEase
  2. {
  3. public:
  4. //更新动画。
  5.    virtual void update(float time);
  6.    //创建一个反向播放的当前动画。
  7.    virtual CCActionInterval* reverse(void);
  8.    //创建一个当前动画的实例拷贝。
  9. virtual CCObject* copyWithZone(CCZone* pZone);
  10. public:
  11.    //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  12. CC_DEPRECATED_ATTRIBUTE static CCEaseBackInOut* actionWithAction(CCActionInterval* pAction);
  13.    //同上
  14. static CCEaseBackInOut* create(CCActionInterval* pAction);
  15. };
  16. //静态函数:创建对应匀速动画的变速动画,参数为一个匀速动画。内部调用create实现。
  17. CCEaseBackInOut* CCEaseBackInOut::actionWithAction(CCActionInterval* pAction)
  18. {
  19. return CCEaseBackInOut::create(pAction);
  20. }
  21. //同上
  22. CCEaseBackInOut* CCEaseBackInOut::create(CCActionInterval* pAction)
  23. {
  24. CCEaseBackInOut *pRet = new CCEaseBackInOut();
  25. if (pRet)
  26. {
  27. if (pRet->initWithAction(pAction))
  28. {
  29. pRet->autorelease();
  30. }
  31. else
  32. {
  33. CC_SAFE_RELEASE_NULL(pRet);
  34. }
  35. }
  36. return pRet;
  37. }
  38. //创建一个当前动画的实例拷贝。
  39. CCObject* CCEaseBackInOut::copyWithZone(CCZone *pZone)
  40. {
  41. CCZone* pNewZone = NULL;
  42. CCEaseBackInOut* pCopy = NULL;
  43. if(pZone && pZone->m_pCopyObject)
  44. {
  45. //in case of being called at sub class
  46. pCopy = (CCEaseBackInOut*)(pZone->m_pCopyObject);
  47. }
  48. else
  49. {
  50. pCopy = new CCEaseBackInOut();
  51. pNewZone = new CCZone(pCopy);
  52. }
  53. pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
  54. CC_SAFE_DELETE(pNewZone);
  55. return pCopy;
  56. }
  57. //动画更新
  58. void CCEaseBackInOut::update(float time)
  59. {
  60.   //容嬷嬷,上曲线!
  61.   
  62. float overshoot = 1.70158f * 1.525f;
  63. time = time * 2;
  64. if (time < 1)
  65. {
  66. m_pOther->update((time * time * ((overshoot + 1) * time - overshoot)) / 2);
  67. }
  68. else
  69. {
  70. time = time - 2;
  71. m_pOther->update((time * time * ((overshoot + 1) * time + overshoot)) / 2 + 1);
  72. }
  73. }
  74. //创建一个反向播放的当前动画。
  75. CCActionInterval* CCEaseBackInOut::reverse()
  76. {
  77. return CCEaseBackInOut::create(m_pOther->reverse());
  78. }

Cocos2d-x 2.0变速动画深入分析相关推荐

  1. Cocos2d-x 2.0 变速动画深入分析

    [Cocos2d-x相关教程来源于红孩儿的游戏编程之路CSDN博客地址:http://blog.csdn.net/honghaier] 红孩儿Cocos2d-X学习园地QQ2群:44208467 加群 ...

  2. Cocos2d-x 2.0 网格动画深入分析

    [Cocos2d-x相关教程来源于红孩儿的游戏编程之路CSDN博客地址:http://blog.csdn.net/honghaier] 红孩儿Cocos2d-X学习园地QQ2群:44208467 加群 ...

  3. Cocos2D研究院之精灵与动画

    转载自雨松MOMO程序研究院本文链接地址:Cocos2D研究院之精灵与动画(六) 通过对导演.场景.层和节点的剖析,现在我们已经可以写出一个完整的游戏体系了,在实际应用中,场景一般都是作为游戏的关卡, ...

  4. 如何制作一个横版格斗过关游戏 Cocos2d x 2 0 4

    分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow 也欢迎大家转载本篇文章.分享知识,造福人民,实现我们中华民族伟大复兴! 本文实践 ...

  5. 《Android开发艺术探索》读书笔记 (7) 第7章 Android动画深入分析

    本节和<Android群英传>中的第七章Android动画机制与使用技巧有关系,建议先阅读该章的总结 第7章 Android动画深入分析 7.1 View动画 (1)android动画分为 ...

  6. Android开发艺术探索——第七章:Android动画深入分析

    Android开发艺术探索--第七章:Android动画深入分析 Android的动画可以分成三种,view动画,帧动画,还有属性动画,其实帧动画也是属于view动画的一种,,只不过他和传统的平移之类 ...

  7. 图文并茂使用CocosBuilder制作Cocos2D游戏 分享0

    图文并茂使用CocosBuilder制作Cocos2D游戏  分享0 目 录 The Game 设置工程 创建动画类型的主界面 本文由Zynga 工程师原创,翻译:Iven,张作宸,Butterfly ...

  8. JavaScript 变速动画封装

    变速动画.html: <!DOCTYPE html> <html> <head lang="en"><meta charset=" ...

  9. Cocos2d-x 2.0 按键加速处理深入分析

    [Cocos2d-x相关教程来源于红孩儿的游戏编程之路CSDN博客地址:http://blog.csdn.net/honghaier 红孩儿Cocos2d-X学习园地QQ2群:44208467 Coc ...

最新文章

  1. qemu-kvm部分流程/源代码分析
  2. 【深度学习入门到精通系列】使用Plotly绘制气泡图(以U-Net等网络性能比较为例)
  3. 设置Flex toolTip的样式
  4. 转:性能测试中的性能测试指标与用户体验分析
  5. webqq2协议分析和qq聊天机器人简单实现(转)
  6. 基于elementui的input的二次封装(非常实用)
  7. Putty(菩提)远程连接服务器教程
  8. 1.13编程基础之综合应用_14求满足条件的3位数
  9. [译]CSV 注入:被人低估的巨大风险
  10. [WP8] ListBox的Item宽度自动填满
  11. java中抽象类的定义_Java中抽象类的定义和使用
  12. VS2015解决非Unicode编码包含中文字段无法编译的问题
  13. sqli注入前置知识
  14. [翻译]XNA在线俱乐部网站即将开站!
  15. 软件公司为什么要加密源代码,而且是前前后后,反反复复
  16. JavaScript return的作用
  17. 平面设计中都有哪些风格?常用的风格有哪些?
  18. virtualbox复制vdi
  19. 我的人生历程之第一篇:游戏篇(b)
  20. C++标准库(第二版,作者_NicolaiMJosuttis)_第六章标准模板库_6.2.4关联式数组

热门文章

  1. 竞赛党关注!2021年五大学科竞赛考试时间,附985高校竞赛要求
  2. 基于VisualStudio历时20年打造的史诗级游戏
  3. ios直播开发基础,推流协议及流程
  4. Linux笔记(70)——文件描述符之ulimit命令
  5. java web工程,传递字符串参数小记
  6. 快点来学吧!9次Android面试经验总结,已开源
  7. 解决网盘下载速度慢的问题
  8. 怎样将PDF中指定页面方向进行旋转
  9. 新Word文档借用旧文档的部分样式
  10. 发力“智能马桶”的小米们,选对了目标群体吗?