cocos2dx 动画常见的22种殊效

前端之家收集整理的这篇文章主要介绍了cocos2dx 动画常见的22种殊效前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


  1. cocos2dx 动画常见的22种殊效
  1. bool HelloWorld::init()
  2. {
  3. //////////////////////////////
  4. // 1. super init first
  5. if !CCLayer::init()
  6. {
  7. return false;
  8. }
  9. CCSize size =CCDirector::sharedDirector()->getWinSize();//获取屏幕大小
  10. CCSprite * sp = CCSprite::create"Icon.png");
  11. sp->setPositionccp200 200));
  12. addChildsp);
  13. // 常见的22种殊效
  14. // CCShaky3D
  15. //感化:创建一个3d晃荡的殊效
  16. // 参数1:晃荡的局限
  17. // 参数2:是否有z轴晃荡
  18. // 参数3: 网格大小
  19. // 参数4:殊效连气儿的时候
  20. // CCActionInterval * shaky3D= CCShaky3D::create(15, false, ccg(15, 10), 4);
  21. // sp->runAction(shaky3D);
  22. // CCShakyTiles3D
  23. // 感化:创建一个3d瓷砖晃荡的殊效
  24. // 参数1:晃荡的局限
  25. // 参数2:是否有z轴晃荡
  26. // 参数3: 网格大小
  27. // 参数4:殊效连气儿的时候
  28. // CCActionInterval * shakyTiles3D = CCShakyTiles3D::create(15, true, ccg(15, 10), 4);
  29. // sp->runAction(shakyTiles3D);
  30. // CCWaves
  31. // 创建一个波动殊效
  32. // 参数1:波动的速度
  33. // 参数2:振幅
  34. // 参数3:程度波动
  35. // 参数4:垂直波动
  36. // 参数5:网格大小
  37. // 参数6:殊效连气儿时候
  38. // CCActionInterval * waves = CCWaves::create(10, 20, true, true, ccg(16, 12), 4);
  39. // sp->runAction(waves);
  40. // CCWaves3D
  41. // 创建一个3D波动殊效
  42. // 参数1:波动的速度
  43. // 参数2:振幅
  44. // 参数3:网格大小
  45. // 参数4:殊效连气儿时候
  46. // CCActionInterval * waves3d= CCWaves3D::create(10, 20, ccg(16, 12), 4);
  47. // sp->runAction(waves3d);
  48. // CCWavesTiles3D
  49. // 创建一个3D瓷砖波动殊效
  50. // 参数1:波动的速度
  51. // 参数2:振幅
  52. // 参数3:网格大小
  53. // 参数4:殊效连气儿时候
  54. // CCActionInterval * wavesTiles3D = CCWavesTiles3D::create(10, 20, ccg(16, 12), 4);
  55. // sp->runAction(wavesTiles3D);
  56. // CCFlipX3D
  57. // 感化:x轴3D反转殊效
  58. // 参数:殊效连气儿的时候
  59. // CCActionInterval *flipX3D= CCFlipX3D::create(4);
  60. // sp->runAction(flipX3D);
  61. // CCFlipY3D
  62. // 感化:Y轴3D反转殊效
  63. // 参数:殊效连气儿的时候
  64. // CCActionInterval * flipY3D = CCFlipY3D::create(4);
  65. // sp->runAction(flipY3D);
  66. // CCLens3D
  67. // 感化: 凸镜殊效
  68. // 参数1:凸镜中间点
  69. // 参数2:凸镜半径
  70. // 参数3:网格大小
  71. // 参数4:网格连气儿时候
  72. // CCActionInterval * lens3D= CCLens3D::create(ointMake(size.width/2, size.height/2), 240, ccg(15, 10), 4);
  73. // sp->runAction(lens3D);
  74.  
  75. // CCRipple3D
  76. // 感化:水波殊效
  77. // 参数1:肇端位子
  78. // 参数2:半径
  79. // 参数3:速度
  80. // 参数4:振幅
  81. // 参数5:网格大小
  82. // 参数6:殊效连气儿的时候
  83. // CCActionInterval * ripple3D= CCRipple3D::create(ointMake(size.width/2, size.height/2), 240, 4, 160, ccg(15,10), 4);
  84. // sp->runAction(ripple3D);
  85. // CCLiquid
  86. // 感化:液体殊效
  87. // 参数1:速度
  88. // 参数2:振幅
  89. // 参数3:网格大小
  90. // 参数4:殊效连气儿时候
  91. // CCActionInterval * liquid = CCLiquid::create(4, 20, ccg(16, 12), 4);
  92. // sp->runAction(liquid);
  93. // CCTwirl
  94. // 感化:扭曲扭转殊效
  95. // 参数1:扭曲扭转中间点
  96. // 参数2:扭曲扭转的次数
  97. // 参数3:振幅
  98. // 参数4:网格大小
  99. // 参数5:殊效连气儿时候
  100. // CCActionInterval * twirl = CCTwirl::create(ointMake(size.width/2, size.height/2), 2, 2.5f, ccg(12, 8), 3);
  101. // sp->runAction(twirl);
  102. // CCShuffleTiles
  103. // 感化:瓷砖的洗牌殊效
  104. // 参数1:随机
  105. // 参数2:网格大小
  106. // 参数3:殊效连气儿的时候
  107. // CCActionInterval *shuffleTiles = CCShuffleTiles::create(16, ccg(16, 12), 2);
  108. // sp->runAction(shuffleTiles);
  109. // CCShatteredTiles3D
  110. // 感化:破裂的3D瓷砖殊效
  111. // 参数1:局限
  112. // 参数2:是否开启z轴
  113. // 参数3:网格大小
  114. // 参数4:殊效连气儿的时候
  115. // CCActionInterval * shatteredTiles3D= CCShatteredTiles3D::create(25, true, ccg(16, 12), 4);
  116. // sp->runAction(shatteredTiles3D);
  117.  
  118. // CCFadeOutTRTiles
  119. // 感化:部落格结果 , 从左下角到右下角
  120. // 参数1:网格大小
  121. // 参数2:殊效连气儿的时候
  122. // CCActionInterval * fadeOutTRTiles = CCFadeOutTRTiles::create(ccg(16, 12), 3);
  123. // sp->runAction(fadeOutTRTiles);
  124.  
  125. // CCFadeOutBLTiles
  126. // 感化:部落格结果 , 从右下角到左下角
  127. // 参数1:网格大小
  128. // 参数2:殊效连气儿的时候
  129. // CCActionInterval * fadeOutBLTiles = CCFadeOutBLTiles::create(ccg(16, 12), 3);
  130. // sp->runAction(fadeOutBLTiles);
  131.  
  132. // CCFadeOutUpTiles
  133. // 感化:折叠结果 从下到上
  134. // 参数1:网格大小
  135. // 参数2:殊效连气儿的时候
  136. // CCActionInterval * fadeOutUpTiles = CCFadeOutUpTiles::create(ccg(16, 12), 3);
  137. // sp->runAction(fadeOutUpTiles);
  138. // CCFadeOutDownTiles
  139. // 感化:折叠结果 从上到下
  140. // 参数1:网格大小
  141. // 参数2:殊效连气儿的时候
  142. // CCActionInterval * fadeOutDownTiles = CCFadeOutDownTiles::create(ccg(16, 12), 3);
  143. // sp->runAction(fadeOutDownTiles);
  144. // CCTurnOffTiles
  145. // 感化:方块消散殊效
  146. // 参数1:网格大小
  147. // 参数2:殊效连气儿的时候
  148. // CCActionInterval * turnOffTiles = CCTurnOffTiles::create(ccg(16, 12), 3);
  149. // sp->runAction(turnOffTiles);
  150.  
  151. // CCJumpTiles3D
  152. // 感化:跳动的方格殊效
  153. // 参数1:跳动的次数
  154. // 参数2:网格的大小
  155. // 参数3:殊效连气儿的时候
  156. // CCActionInterval * jumpTiles3D = CCJumpTiles3D::create(1, 30, ccg(15, 10), 2);
  157. // sp->runAction(jumpTiles3D);
  158. // CCSplitRows
  159. // 感化:分多行消散殊效
  160. // 参数1:行数
  161. // 参数2:殊效连气儿的时候
  162. // CCActionInterval *splitRows= CCSplitRows::create(20, 2);
  163. // sp->runAction(splitRows);
  164.  
  165. // CCSplitCols
  166. // 感化:分多列消散殊效
  167. // 参数1:列数
  168. // 参数2:殊效连气儿的时候
  169. // CCActionInterval * splitCols = CCSplitCols::create(20, 2);
  170. // sp->runAction(splitCols);
  171. // ageTurn3D
  172. // 感化:3D翻页殊效
  173. // 参数1:网格大小
  174. // 参数2:殊效连气儿的时候
  175. CCActionInterval * pageTurn3D = ageTurn3D::createccg15 10), 3);
  176. sp->runActionpageTurn3D);
  177. return true;
  178. }

猜你在找的Cocos2d-x相关文章