1. CCSprite* sp = CCSprite::create("Default.png");
  2. sp->setPosition(ccp(, ));
  3. addChild(sp);
  4.  
  5. //常见的22种特效
  6.  
  7. //3D晃动的特效
  8. // CCActionInterval* shaky3D = CCShaky3D::create(5, CCSize(10, 10), 15, false);
  9. // sp->runAction(shaky3D);
  10.  
  11. //3D瓷砖晃动特效
  12. // CCActionInterval* shakyTiles3D = CCShakyTiles3D::create(5, CCSize(10, 10), 5, false);
  13. // sp->runAction(shakyTiles3D);
  14.  
  15. //波动特效
  16. // CCActionInterval* waves = CCWaves::create(5, CCSize(10, 10), 10, 20, true, true);
  17. // sp->runAction(waves);
  18.  
  19. //3D波动特效
  20. // CCActionInterval* waves3D = CCWaves3D::create(5, CCSize(10, 10), 10, 20);
  21. // sp->runAction(waves3D);
  22.  
  23. //3D瓷砖波动特效
  24. // CCActionInterval* wavesTiles3D = CCWavesTiles3D::create(5, CCSize(10, 10), 10, 20);
  25. // sp->runAction(wavesTiles3D);
  26.  
  27. //X轴 3D反转特效
  28. // CCActionInterval* filpX = CCFlipX3D::create(5);
  29. // sp->runAction(filpX);
  30.  
  31. //Y轴3D反转特效
  32. // CCActionInterval* filpY = CCFlipY3D::create(5);
  33. // sp->runAction(filpY);
  34.  
  35. //凸透镜特效
  36. // CCActionInterval* lens = CCLens3D::create(2, CCSize(10, 10),CCPointMake(240, 160), 240);
  37. // sp->runAction(lens);
  38.  
  39. //水波纹特效
  40. // CCActionInterval* ripple = CCRipple3D::create(5, CCSize(10, 10), CCPointMake(240, 160), 240, 4, 160);
  41. // sp->runAction(ripple);
  42.  
  43. //液体特效
  44. // CCActionInterval* liquid = CCLiquid::create(5, CCSize(10, 10), 4, 20);
  45. // sp->runAction(liquid);
  46.  
  47. //扭曲旋转特效
  48. // CCActionInterval* twirl = CCTwirl::create(50, CCSize(10, 10), CCPointMake(240, 160), 2, 2.5);
  49. // sp->runAction(twirl);
  50.  
  51. //破碎的3D瓷砖特效
  52. // CCActionInterval* shatteredTiles = CCShatteredTiles3D::create(15, CCSize(10, 10), 50, true);
  53. // sp->runAction(shatteredTiles);
  54.  
  55. //瓷砖洗牌特效
  56. // CCActionInterval* shuffle = CCShuffleTiles::create(5, CCSize(50, 50), 50);
  57. // sp->runAction(shuffle);
  58.  
  59. //部落格效果,从左下角到右上角
  60. // CCActionInterval* fadeOutTRTiles = CCFadeOutTRTiles::create(5, CCSize(50, 50));
  61. // sp->runAction(fadeOutTRTiles);
  62.  
  63. //部落格效果,从右上角到左下角
  64. // CCActionInterval* fadeOutBLTiles = CCFadeOutBLTiles::create(5, CCSize(50, 50));
  65. // sp->runAction(fadeOutBLTiles);
  66.  
  67. //折叠效果 从下到上
  68. // CCActionInterval* fadeOutUpTiles = CCFadeOutUpTiles::create(5, CCSize(10, 10));
  69. // sp->runAction(fadeOutUpTiles);
  70.  
  71. //折叠效果,从上到下
  72. // CCActionInterval* fadeOutDownTiles = CCFadeOutDownTiles::create(4, CCSize(20, 50));
  73. // sp->runAction(fadeOutDownTiles);
  74.  
  75. //方块消失特效
  76. // CCActionInterval* turnOffFiels = CCTurnOffTiles::create(4, CCSize(50, 50));
  77. // sp->runAction(turnOffFiels);
  78.  
  79. //跳动的方块特效
  80. // CCActionInterval* jumpTiles = CCJumpTiles3D::create(5, CCSize(20, 20), 5, 20);
  81. // sp->runAction(jumpTiles);
  82.  
  83. //分多行消失特效
  84. // CCActionInterval* splitCols = CCSplitCols::create(5, 50);
  85. // sp->runAction(splitCols);
  86.  
  87. //分多列消失特效
  88. // CCActionInterval* splitRows = CCSplitRows::create(5, 50);
  89. // sp->runAction(splitRows);
  90.  
  91. //3D翻页特效
  92. CCActionInterval* pageTurn3D = CCPageTurn3D::create(, CCSize(, ));
  93. sp->runAction(pageTurn3D);
  94.  
  95. //这个是光晕效果的参数
  96. CCSpriteBatchNode *m_Batchnode=CCSpriteBatchNode::create("bullet.png");ccBlendFunc cb={GL_SRC_ALPHA,GL_ONE};
  97. //将光晕效果加入
  98. m_Batchnode->setBlendFunc(cb);
  99. //最后实例化一个
  100. CCSpriteBatchNodethis->addChild(m_Batchnode);
  101. //缓存中取出W1.png图片,这个图片是在plist文件中所在的<key>标签里面的
  102. CCSpriteCCSprite *bullet=CCSprite::createWithSpriteFrameName("W1.png");
  103. //记得不是用this->addChild而是用m_Batchnode->addChild(bullet);
  104. //这样就能有光晕效果啦 主要是理解CCSpriteBatchNode
  105. bullet->setPosition(ccp(x,y));
  106. m_Batchnode->addChild(bullet);
  107.  
  108. //1. 不断旋转
  109. CCRotateBy* rotate = CCRotateBy::actionWithDuration(, );
  110. CCRepeatForever* repeatRotate = CCRepeatForever::actionWithAction(rotate);
  111.  
  112. //2. 上升消失
  113. CCMoveBy* move = CCMoveBy::actionWithDuration(, ccp(,));
  114. CCFadeOut* fadeOut = CCFadeOut::actionWithDuration();
  115. CCFiniteTimeAction* fadeOutAct = CCSpawn::actions(move,fadeOut,NULL);
  116.  
  117. //3.贝赛而曲线
  118. ccBezierConfig bezier;
  119. bezier.controlPoint_1 = ccp(,);
  120. bezier.controlPoint_2 = ccp(, -);
  121. bezier.endPosition = ccp(, );
  122. CCBezierBy* bezierBy = CCBezierBy::actionWithDuration(5.0, bezier);
  123.  
  124. //4. 变色
  125. CCTintTo* tint1 = CCTintTo::actionWithDuration(1.5, , , );
  126. CCTintTo* tint2 = CCTintTo::actionWithDuration(1.5, , , );
  127. CCTintTo* tint3 = CCTintTo::actionWithDuration(1.5, , , );
  128. CCFiniteTimeAction* tintActions = CCSequence::actions(tint1,tint2,tint3,NULL);
  129. CCRepeatForever* repeatTint = CCRepeatForever::actionWithAction((CCActionInterval*)tintActions);
  130.  
  131. //5.闪烁
  132. CCBlink* blink = CCBlink::actionWithDuration(, );
  133.  
  134. //6.动作(动画)结束后,调用某函数
  135. CCFadeOut* fadeOut = CCFadeOut::actionWithDuration(0.8);
  136. CCCallFunc* endCall = CCCallFunc::actionWithTarget(starSprite, callfunc_selector(FlashingMeteors::removeFromParentAndCleanup));
  137. CCFiniteTimeAction* acts = CCSequence::actions(fadeOut,endCall, NULL);
  138. starSprite->runAction(acts);

cocos2d-x 2.x 图层特效Effect(转)的更多相关文章

  1. CSS3Ps -Photoshop图层特效转CSS3代码

    CSS3Ps 这个ps插件可以将ps图层特效直接转化成css3代码,对前端非常有益. 插件下载:http://css3ps.com/Download/

  2. 一些WPF中的滤镜特效——Effect Library

    WPF支持类似PhotoShop的滤镜功能,称之为Effect.在.Net 4.0中,WPF就废弃了对BitMapEffect的支持,转向使用支持GPU加速的Effect类,例如,我们可以使用如下代码 ...

  3. [一位菜鸟的COCOS-2D编程之路]COCOS2D中得动作,特效和动画

    一,CCActionManager 管理所有节点动作的对象 来看看打飞机里面的一个onEnter 方法 - (void)onEnter { [super onEnter]; //一定要注意添加此方法, ...

  4. PS图层混合模式实例详解

          PS中的很多概念都和Core Graphics中的概念相通,比如蒙版.路径.裁剪.混合模式等等.如果你对Core Graphics中的混合模式不太理解,阅读本篇文章能让你对Core Gra ...

  5. prototype.js简介

    prototype.js简介 2007-11-21 14:22 prototype.js是一个很强大的Javascript函数库,它可以让你很轻松的使用一些特效,实现AJAX的功能.虽然prototy ...

  6. 网页设计师常用的PHOTOSHOP插件

    Photoshop是网页设计师常用的一个非常重要而强大的工具,可以让网页设计师的工作高效便捷的进行,也为设计师们的天马行空提供了实际技术实现.一般我们的网页设计师设计完成后,需要将其转换制作成网页形式 ...

  7. qTip2 精致的jQuery提示信息插件

    qTip2 精致的jQuery提示信息插件    出处:http://www.cnblogs.com/lwme/archive/2012/02/16/qtip2-jquery-plugin.html ...

  8. Win2D 官方文章系列翻译 - 幕后绘制

    本文为个人博客备份文章,原文地址: http://validvoid.net/win2d-offscreen-drawing/ 应用有时需要将图形绘制到并不立即显示的目标上.此类绘制动作被称作“幕后绘 ...

  9. Jquery qTip2实现多种提示效果,支持ajax,以及多种样式

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

随机推荐

  1. ajax调用webservice(二) 跨域。

    所需工具与项目结构同(一). service.asmx中代码如下: using System; using System.Collections.Generic; using System.Web; ...

  2. this computer does not support Intel Virtualization Technology (VT-x) .Haxm can'not be installed

    this computer does not support Intel Virtualization Technology (VT-x) .Haxm can'not be installed 本机不 ...

  3. JS 实现 Tab标签切换功能

    Tab标签切换 效果图: HTML部分: <div class="wrap">     <ul id="tag">       < ...

  4. 武汉科技大学ACM:1010: 零起点学算法27——判断是否直角三角形

    Problem Description 输入三个整数,分别代表三角形的三条边长度,判断能否构成直角三角形 Input 输入3个整数a,b,c(多组数据,-5000000<a,b,c<500 ...

  5. CRT内存调试标记

    static unsigned char _bNoMansLandFill = 0xFD; /* fill no-man's land with this */ static unsigned cha ...

  6. Android中通过Java获取Webview加载内容

    有时候我们需要在加载webview时,获取加载完成的内容,当然,WebView也是有可能包含javascript.通过以下操作,我们是可以获取到WebView加载的内容. 1.自定义一个内部类,获取W ...

  7. eclipse  sae上传代码

    eclipse  sae上传代码http://www.sinacloud.com/doc/sae/java/tools.html#eclipse 来自为知笔记(Wiz)

  8. 监听<input/>标签行为的方法总结

    一.内容改变 1.<input onchange="javascript:function()"/>方法 onchange可以替换为下面几种:oninput,onpro ...

  9. PHPCMS V9 简单的二次开发

    更多二次开发技巧,查看phpcms系统帮助 ,前台模板解析后的缓存 caches\caches_template\default 前台控制类index.php,前台标签类*_tag.class.php ...

  10. C语言文件操作解析(五)之EOF解析(转载)

      C语言文件操作解析(五)之EOF解析 在C语言中,有个符号大家都应该很熟悉,那就是EOF(End of File),即文件结束符.但是很多时候对这个理解并不是很清楚,导致在写代码的时候经常出错,特 ...