//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. Unity学习-工具准备(一)

    工具介绍 Unity 4.5.4 VS2013 Visual Studio 2013 Tools for Unity unity3d圣典 五大面板 Hierarchy:场景资源面板 [管理 当前场景 ...

  2. Unity引擎 UGUI

    Unity UGUI讲解 1.导入UI图片资源 2.设置参数: TextureType(纹理类型) 精灵 2D and UI SpriteMode(精灵模式)  Single(单) multiple( ...

  3. webSocket客服在线交谈

    一>用户端 <%@ page language="java" pageEncoding="UTF-8" %><%@ taglib uri ...

  4. 移动web——bootstrap响应式轮播图

    基本介绍 1.bootstrap有轮播图的模板,我们只需要改动下就行. 2.这里我们将介绍桌面版本和移动版本最后是综合版本 桌面版本 1.这里的图片设置是有窍门的,不再去添加img标签,而是作为a标签 ...

  5. html——相对路径、绝对路径(有待补充....)

    相对路径主要看你访问的文件相对自己的页面在哪个文件夹下.如果自己藏的很深,必须用“../”跳出.如果项目中的文件位置分布是这样: 那么index页面若要访问这两张图片就需要用相对路径: <img ...

  6. C# Task多线程

    来自Eleven老师示例 private void btnTask_Click(object sender, EventArgs e) { Console.WriteLine(); Console.W ...

  7. Oreacle 语句

    SELECT * FROM = and CREATETIME >to_date('2019-01-01' , 'yyyy-mm-dd hh24:mi:ss') and CREATETIME &l ...

  8. privot函数使用

    语法: table_source PIVOT( 聚合函数(value_column) FOR pivot_column IN(<column_list>) ) 将列转化为行 写个小示例 : ...

  9. ngFor 循环带索引

    *ngFor="let item of userList,let i = index"   或者 *ngFor="let item of userList index a ...

  10. css3的基础知识

    transfrom的应用: 1.旋转:transform: rotate(30deg): 2.阴影效果:box-shadow: 10px 10px 5px #888888: 3.鼠标移入放大:tran ...