Egret之粒子系統
阿新 • • 發佈:2017-10-04
egret 粒子
使用Egret土特產Egret Feather粒子編輯器 。 導出流星粒子特效如下如下:
導出2個文件 :
一 , 準備工作 :加入粒子模塊 , 粒子系統在第三方庫裏面。所以需要下載第三方庫加入到項目裏面
①:下載第三方庫
②:加入到項目(這裏我只是將庫放在與項目平級的目錄裏面,而且我只是取出了)
③:在egretProperties.json的配置
④:使用egret build -e命令
關於粒子核心
module app { export class ParticleView extends eui.Component implements eui.UIComponent{ private particleSys : particle.GravityParticleSystem; public constructor() { super(); this.skinName = "resource/eui_skins/ParticleE.exml"; } protected partAdded(partName : string , instance : any):void{ super.partAdded(partName , instance); } protected childrenCreated():void{ super.childrenCreated(); this.startSyncLoadLizi(); } private startSyncLoadLizi() : void{ this.syncLoadLizi("plizi_json"); } private syncLoadLizi( resName : string ) : void{ var self = this; RES.getResAsync(resName, function(data: any,key: string): void { if(key == "plizi_json") { self.syncLoadLizi("plizi_png"); } else if(key == "plizi_png") { this.initParticle(); } }, this); } /** * 初始化例子系統 */ private initParticle() : void{ var texture = RES.getRes("plizi_png"); var config = RES.getRes("plizi_json"); this.particleSys = new particle.GravityParticleSystem(texture, config); this.addChild( this.particleSys ); this.particleSys.start(); } } }
核心::::
var texture = RES.getRes("plizi_png");
var config = RES.getRes("plizi_json");
this.particleSys = new particle.GravityParticleSystem(texture, config);
this.addChild( this.particleSys );
this.particleSys.start();
效果:
Good 。。
本文出自 “Better_Power_Wisdom” 博客,請務必保留此出處http://aonaufly.blog.51cto.com/3554853/1970362
Egret之粒子系統