//plist文件中面有粒子效果的各种參数
//textureFileName相应着使用粒子的图片
auto particle = ParticleSystemQuad::create("starFlash.plist");
particle->setPosition(Vec2(s.width / 2, s.height / 2));
addChild(particle); //全部的配置也能够自己写
auto p2 = ParticleSystemQuad::createWithTotalParticles(200);
p2->setTexture(Director::getInstance()->getTextureCache()->addImage("CloseNormal.png"));
p2->setPosition(Vec2(100, 100));
// duration
p2->setDuration(ParticleSystem::DURATION_INFINITY); // radius mode
p2->setEmitterMode(ParticleSystem::Mode::RADIUS); // radius mode: start and end radius in pixels
p2->setStartRadius(4);
p2->setStartRadiusVar(1);
p2->setEndRadius(ParticleSystem::START_RADIUS_EQUAL_TO_END_RADIUS);
p2->setEndRadiusVar(0); // radius mode: degrees per second
p2->setRotatePerSecond(100);
p2->setRotatePerSecondVar(0); // angle
p2->setAngle(90);
p2->setAngleVar(0); // emitter position
auto size = Director::getInstance()->getWinSize();
p2->setPosVar(Point::ZERO); // life of particles
p2->setLife(0.5);
p2->setLifeVar(0); // spin of particles
p2->setStartSpin(0);
p2->setStartSpinVar(0);
p2->setEndSpin(0);
p2->setEndSpinVar(0); // color of particles
Color4F startColor(0.0f, 0.8f, 0.9f, 1.0f);
p2->setStartColor(startColor); Color4F startColorVar(0, 0, 0, 1.0f);
p2->setStartColorVar(startColorVar); Color4F endColor(1.0f, 1.0f, 1.0f, 0.1f);
p2->setEndColor(endColor); Color4F endColorVar(0, 0, 0, 0.1f);
p2->setEndColorVar(endColorVar); // size, in pixels
p2->setStartSize(20);
p2->setStartSizeVar(1);
p2->setEndSize(0); // emits per second
p2->setEmissionRate(p2->getTotalParticles() / p2->getLife()); // additive
p2->setBlendAdditive(false); //addChild(p2);
p2->setPosition(Point(200,200));
addChild(p2);

cocos2d-x 3.1.1 学习笔记[16] Particle 粒子效果的更多相关文章

  1. cocos2d-x 3.1.1 学习笔记[4]GridActions 网格动画

    文章写的  http://blog.csdn.net/zhouyunxuan 老样子.见代码. //GridActions can only used on NodeGrid auto nodeGri ...

  2. [XMPP]iOS聊天软件学习笔记[一]

    @import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...

  3. cocos2d-x 3.1.1学习笔记[23]寻找主循环 mainloop

    文章出自于  http://blog.csdn.net/zhouyunxuan cocos2d到底是怎样把场景展示给我们的,我一直非常好奇. 凭个人猜想,引擎内部的结构类似于这样 while(true ...

  4. cocos2d-x 3.1.1 学习笔记[3]Action 动作

    这些动画貌似都非常多的样子,就所有都创建一次. 代码例如以下: /* 动画*/ auto sp = Sprite::create("card_bg_big_26.jpg"); Si ...

  5. cocos2d-x 3.1.1 学习笔记[2]Sprite 精灵

    Sprite应该是用到最多的一个类吧.无法想像一个游戏没有精灵将怎样进行愉快的玩耍. Sprite继承于Node 和 TextureProtocol. Sprite是一个2d的图像. Sprite能够 ...

  6. cocos2d-x 3.1.1 学习笔记[21]cocos2d-x 创建过程

    文章出自于  http://blog.csdn.net/zhouyunxuan RootViewController.h #import <UIKit/UIKit.h> @interfac ...

  7. cocos2d-x 3.1.1 学习笔记[11] http请求 + json解析

    //http须要引入的头文件和命名空间 #include <network/HttpClient.h> using namespace network; //json须要引入的头文件 #i ...

  8. [XMPP]iOS聊天软件学习笔记[四]

    昨天完成了聊天界面,基本功能算告一段落 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework git clone https://githu ...

  9. [XMPP]iOS聊天软件学习笔记[三]

    今天做了好友界面,其实xmpp内部已经写好很多扩展模块,所以使用起来还是很方便的 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework gi ...

随机推荐

  1. CUDA-GPU编程

    参考:http://blog.csdn.net/augusdi/article/details/12833235  第二节 新建NVIDIA项目: 新建项目及会生成一个简单的代码demo,计算矩阵的加 ...

  2. html——导航demo

    通过行内块.伪类对导航栏进行设置 <!DOCTYPE html> <html> <head> <meta charset="utf-8" ...

  3. VC++ 遍历文件夹

    }; strcpy_s(szFind, MAX_PATH, m_szDir); strcat_s(szFind, "\\*.*"); WIN32_FIND_DATA wfd; HA ...

  4. 用C#在Visual Studio写Javascript单元测试(Firefox内核)

    引用nuget包: 注意:Geckofx45 nuget包必须是最后引用,否则初始化会出错 编写JsRunner using Gecko; using System; using System.Col ...

  5. VS2015编译ffmpeg的问题解决

    刚装了vs2015,打开一些ffmpeg项目,发现不能编译通过,包括stdio.h都无法找到,可能是vs2015的bug吧. 现在记录一下解决方法: 我的目录是这样定义的: C:\Program Fi ...

  6. What is the difference between rhel 6 and rhel7

    What is the difference between rhel 6 and rhel7 difference rhel 6 RHEL 7 release date 10 NOV 2010 as ...

  7. vue自定义轻量级form表单校验

    遇到了form表单提交的需求,找了vue的组件觉得不够灵活,有时间自己写了一个. 调用方法 全局引入注册: import va from 'global/js/va' va.install(Vue); ...

  8. 18清明校内测试T3

    扫雷(mine) Time Limit:1000ms   Memory Limit:128MB 题目描述 rsy最近沉迷于一款叫扫雷的游戏. 这个游戏是这样的.一开始网格上有n*m个位置,其中有一些位 ...

  9. Linux之iptables(三、命令--->单主机)

    iptables命令规则格式: iptables [-t table] SUBCOMMAND chain [-m matchname[per-match-options]] -j targetname ...

  10. Linux之iptables(一、防火墙的概念)

    防火墙的概念 一.安全技术 入侵检测与管理系统(Intrusion Detection Systems):特点是不阻断任何网络访问,量化.定位来自内外网络的威胁情况,主要以提供报告和事后监督为主,提供 ...