cocos2d-x 2.x 图层特效Effect(转)
- CCSprite* sp = CCSprite::create("Default.png");
- sp->setPosition(ccp(, ));
- addChild(sp);
- //常见的22种特效
- //3D晃动的特效
- // CCActionInterval* shaky3D = CCShaky3D::create(5, CCSize(10, 10), 15, false);
- // sp->runAction(shaky3D);
- //3D瓷砖晃动特效
- // CCActionInterval* shakyTiles3D = CCShakyTiles3D::create(5, CCSize(10, 10), 5, false);
- // sp->runAction(shakyTiles3D);
- //波动特效
- // CCActionInterval* waves = CCWaves::create(5, CCSize(10, 10), 10, 20, true, true);
- // sp->runAction(waves);
- //3D波动特效
- // CCActionInterval* waves3D = CCWaves3D::create(5, CCSize(10, 10), 10, 20);
- // sp->runAction(waves3D);
- //3D瓷砖波动特效
- // CCActionInterval* wavesTiles3D = CCWavesTiles3D::create(5, CCSize(10, 10), 10, 20);
- // sp->runAction(wavesTiles3D);
- //X轴 3D反转特效
- // CCActionInterval* filpX = CCFlipX3D::create(5);
- // sp->runAction(filpX);
- //Y轴3D反转特效
- // CCActionInterval* filpY = CCFlipY3D::create(5);
- // sp->runAction(filpY);
- //凸透镜特效
- // CCActionInterval* lens = CCLens3D::create(2, CCSize(10, 10),CCPointMake(240, 160), 240);
- // sp->runAction(lens);
- //水波纹特效
- // CCActionInterval* ripple = CCRipple3D::create(5, CCSize(10, 10), CCPointMake(240, 160), 240, 4, 160);
- // sp->runAction(ripple);
- //液体特效
- // CCActionInterval* liquid = CCLiquid::create(5, CCSize(10, 10), 4, 20);
- // sp->runAction(liquid);
- //扭曲旋转特效
- // CCActionInterval* twirl = CCTwirl::create(50, CCSize(10, 10), CCPointMake(240, 160), 2, 2.5);
- // sp->runAction(twirl);
- //破碎的3D瓷砖特效
- // CCActionInterval* shatteredTiles = CCShatteredTiles3D::create(15, CCSize(10, 10), 50, true);
- // sp->runAction(shatteredTiles);
- //瓷砖洗牌特效
- // CCActionInterval* shuffle = CCShuffleTiles::create(5, CCSize(50, 50), 50);
- // sp->runAction(shuffle);
- //部落格效果,从左下角到右上角
- // CCActionInterval* fadeOutTRTiles = CCFadeOutTRTiles::create(5, CCSize(50, 50));
- // sp->runAction(fadeOutTRTiles);
- //部落格效果,从右上角到左下角
- // CCActionInterval* fadeOutBLTiles = CCFadeOutBLTiles::create(5, CCSize(50, 50));
- // sp->runAction(fadeOutBLTiles);
- //折叠效果 从下到上
- // CCActionInterval* fadeOutUpTiles = CCFadeOutUpTiles::create(5, CCSize(10, 10));
- // sp->runAction(fadeOutUpTiles);
- //折叠效果,从上到下
- // CCActionInterval* fadeOutDownTiles = CCFadeOutDownTiles::create(4, CCSize(20, 50));
- // sp->runAction(fadeOutDownTiles);
- //方块消失特效
- // CCActionInterval* turnOffFiels = CCTurnOffTiles::create(4, CCSize(50, 50));
- // sp->runAction(turnOffFiels);
- //跳动的方块特效
- // CCActionInterval* jumpTiles = CCJumpTiles3D::create(5, CCSize(20, 20), 5, 20);
- // sp->runAction(jumpTiles);
- //分多行消失特效
- // CCActionInterval* splitCols = CCSplitCols::create(5, 50);
- // sp->runAction(splitCols);
- //分多列消失特效
- // CCActionInterval* splitRows = CCSplitRows::create(5, 50);
- // sp->runAction(splitRows);
- //3D翻页特效
- CCActionInterval* pageTurn3D = CCPageTurn3D::create(, CCSize(, ));
- sp->runAction(pageTurn3D);
- //这个是光晕效果的参数
- CCSpriteBatchNode *m_Batchnode=CCSpriteBatchNode::create("bullet.png");ccBlendFunc cb={GL_SRC_ALPHA,GL_ONE};
- //将光晕效果加入
- m_Batchnode->setBlendFunc(cb);
- //最后实例化一个
- CCSpriteBatchNode里this->addChild(m_Batchnode);
- //缓存中取出W1.png图片,这个图片是在plist文件中所在的<key>标签里面的
- CCSpriteCCSprite *bullet=CCSprite::createWithSpriteFrameName("W1.png");
- //记得不是用this->addChild而是用m_Batchnode->addChild(bullet);
- //这样就能有光晕效果啦 主要是理解CCSpriteBatchNode
- bullet->setPosition(ccp(x,y));
- m_Batchnode->addChild(bullet);
- //1. 不断旋转
- CCRotateBy* rotate = CCRotateBy::actionWithDuration(, );
- CCRepeatForever* repeatRotate = CCRepeatForever::actionWithAction(rotate);
- //2. 上升消失
- CCMoveBy* move = CCMoveBy::actionWithDuration(, ccp(,));
- CCFadeOut* fadeOut = CCFadeOut::actionWithDuration();
- CCFiniteTimeAction* fadeOutAct = CCSpawn::actions(move,fadeOut,NULL);
- //3.贝赛而曲线
- ccBezierConfig bezier;
- bezier.controlPoint_1 = ccp(,);
- bezier.controlPoint_2 = ccp(, -);
- bezier.endPosition = ccp(, );
- CCBezierBy* bezierBy = CCBezierBy::actionWithDuration(5.0, bezier);
- //4. 变色
- CCTintTo* tint1 = CCTintTo::actionWithDuration(1.5, , , );
- CCTintTo* tint2 = CCTintTo::actionWithDuration(1.5, , , );
- CCTintTo* tint3 = CCTintTo::actionWithDuration(1.5, , , );
- CCFiniteTimeAction* tintActions = CCSequence::actions(tint1,tint2,tint3,NULL);
- CCRepeatForever* repeatTint = CCRepeatForever::actionWithAction((CCActionInterval*)tintActions);
- //5.闪烁
- CCBlink* blink = CCBlink::actionWithDuration(, );
- //6.动作(动画)结束后,调用某函数
- CCFadeOut* fadeOut = CCFadeOut::actionWithDuration(0.8);
- CCCallFunc* endCall = CCCallFunc::actionWithTarget(starSprite, callfunc_selector(FlashingMeteors::removeFromParentAndCleanup));
- CCFiniteTimeAction* acts = CCSequence::actions(fadeOut,endCall, NULL);
- starSprite->runAction(acts);
cocos2d-x 2.x 图层特效Effect(转)的更多相关文章
- CSS3Ps -Photoshop图层特效转CSS3代码
CSS3Ps 这个ps插件可以将ps图层特效直接转化成css3代码,对前端非常有益. 插件下载:http://css3ps.com/Download/
- 一些WPF中的滤镜特效——Effect Library
WPF支持类似PhotoShop的滤镜功能,称之为Effect.在.Net 4.0中,WPF就废弃了对BitMapEffect的支持,转向使用支持GPU加速的Effect类,例如,我们可以使用如下代码 ...
- [一位菜鸟的COCOS-2D编程之路]COCOS2D中得动作,特效和动画
一,CCActionManager 管理所有节点动作的对象 来看看打飞机里面的一个onEnter 方法 - (void)onEnter { [super onEnter]; //一定要注意添加此方法, ...
- PS图层混合模式实例详解
PS中的很多概念都和Core Graphics中的概念相通,比如蒙版.路径.裁剪.混合模式等等.如果你对Core Graphics中的混合模式不太理解,阅读本篇文章能让你对Core Gra ...
- prototype.js简介
prototype.js简介 2007-11-21 14:22 prototype.js是一个很强大的Javascript函数库,它可以让你很轻松的使用一些特效,实现AJAX的功能.虽然prototy ...
- 网页设计师常用的PHOTOSHOP插件
Photoshop是网页设计师常用的一个非常重要而强大的工具,可以让网页设计师的工作高效便捷的进行,也为设计师们的天马行空提供了实际技术实现.一般我们的网页设计师设计完成后,需要将其转换制作成网页形式 ...
- qTip2 精致的jQuery提示信息插件
qTip2 精致的jQuery提示信息插件 出处:http://www.cnblogs.com/lwme/archive/2012/02/16/qtip2-jquery-plugin.html ...
- Win2D 官方文章系列翻译 - 幕后绘制
本文为个人博客备份文章,原文地址: http://validvoid.net/win2d-offscreen-drawing/ 应用有时需要将图形绘制到并不立即显示的目标上.此类绘制动作被称作“幕后绘 ...
- Jquery qTip2实现多种提示效果,支持ajax,以及多种样式
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
随机推荐
- ajax调用webservice(二) 跨域。
所需工具与项目结构同(一). service.asmx中代码如下: using System; using System.Collections.Generic; using System.Web; ...
- 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 本机不 ...
- JS 实现 Tab标签切换功能
Tab标签切换 效果图: HTML部分: <div class="wrap"> <ul id="tag"> < ...
- 武汉科技大学ACM:1010: 零起点学算法27——判断是否直角三角形
Problem Description 输入三个整数,分别代表三角形的三条边长度,判断能否构成直角三角形 Input 输入3个整数a,b,c(多组数据,-5000000<a,b,c<500 ...
- CRT内存调试标记
static unsigned char _bNoMansLandFill = 0xFD; /* fill no-man's land with this */ static unsigned cha ...
- Android中通过Java获取Webview加载内容
有时候我们需要在加载webview时,获取加载完成的内容,当然,WebView也是有可能包含javascript.通过以下操作,我们是可以获取到WebView加载的内容. 1.自定义一个内部类,获取W ...
- eclipse sae上传代码
eclipse sae上传代码http://www.sinacloud.com/doc/sae/java/tools.html#eclipse 来自为知笔记(Wiz)
- 监听<input/>标签行为的方法总结
一.内容改变 1.<input onchange="javascript:function()"/>方法 onchange可以替换为下面几种:oninput,onpro ...
- PHPCMS V9 简单的二次开发
更多二次开发技巧,查看phpcms系统帮助 ,前台模板解析后的缓存 caches\caches_template\default 前台控制类index.php,前台标签类*_tag.class.php ...
- C语言文件操作解析(五)之EOF解析(转载)
C语言文件操作解析(五)之EOF解析 在C语言中,有个符号大家都应该很熟悉,那就是EOF(End of File),即文件结束符.但是很多时候对这个理解并不是很清楚,导致在写代码的时候经常出错,特 ...