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/ ...
随机推荐
- jQuery 小知识点(插件)
1.jQuery插件小知识点: 估计很多人都没弄明白下面的东西,特从网络上搜索了下面的知识,自己以后用起来也比较方便: $.fn是指jquery的命名空间,加上fn上的方法及属性,会对jquery实例 ...
- ADO.NET 新特性之SqlBulkCopy(批量插入大量数据)
转自:http://blog.csdn.net/huaer1011/article/details/2312361 在.Net1.1中无论是对于批量插入整个DataTable中的所有数据到数据库中,还 ...
- Thinkphp 连接数据库、查询、添加
一.连接数据库配置及Model数据模型层 1. Thinkphp\conf\convertion.php中找到数据库设置部分,复制到自己的配置文件中,并添加好有关数据库的内容 JiaoWu\Home\ ...
- ubuntu下怎么显示右上角的小键盘
Ubuntu右上角小键盘不见了解决方法: ibus输入法的图标经常消失,输入中文时很不方便,重启一下ibus! 按Ctrl+ALT+T 快捷键打开终端, 输入: 1.killall ibu ...
- android-support-v7-appcompat下载
http://download.csdn.net/detail/u010556601/7449661 将压缩包解压,放入sdk\extras\android\support\v7目录下 在eclips ...
- 转:VC中WORD,DWORD,unsigned long,unsigned short的区别(转)
typedef unsigned long DWORD;typedef int BOOL;typedef unsigned char BYTE; ...
- Android 读取和保存文件(手机内置存储器)
1:activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/androi ...
- the smallest positive number
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any rema ...
- C51 的重入问题 WARNING L15: MULTIPLE CALL TO SEGMENT
WARNING L15: MULTIPLE CALL TO SEGMENT 这个问题必须注意,可能引起程序冲突,假设你用于自动化领域,则可能导致信号产生尖峰. 产生这一警告的一个根源是:你在主循环里调 ...
- android 通过post方式提交数据的最简便有效的方法
public boolean post(String username, String password) throws Exception { username = URLEncoder.encod ...