zoukankan      html  css  js  c++  java
  • Starling 粒子particlesystem 使用实例

    转自:http://wiki.starling-framework.org/extensions/particlesystem

    // embed configuration XML
    [Embed(source="fire.pex", mimeType="application/octet-stream")]
    private static const FireConfig:Class;
     
    // embed particle texture
    [Embed(source = "fire_particle.png")]
    private static const FireParticle:Class;
     
    // instantiate embedded objects
    var psConfig:XML = XML(new FireConfig());
    var psTexture:Texture = Texture.fromBitmap(new FireParticle());
     
    // create particle system
    var ps:PDParticleSystem = new PDParticleSystem(psConfig, psTexture);
    ps.x = 160;
    ps.y = 240;
     
    // add it to the stage and the juggler
    addChild(ps);
    Starling.juggler.add(ps);
     
    // change position where particles are emitted
    ps.emitterX = 20;
    ps.emitterY = 40;
     
    // start emitting particles
    ps.start();
     
    // emit particles for two seconds, then stop
    ps.start(2.0);
     
    // stop emitting particles; on restart, it will continue from the current state
    ps.pause();
     
    // stop emitting particles; on restart, it will start from scratch
    ps.stop();
  • 相关阅读:
    Sublime Text3安装包管理
    Ubuntu下的Sun Java的安装与配置
    求最大面积--------O(n)复杂度
    求最大面积
    gas stations
    n皇后问题
    Triangle --- 至顶向下求最小值
    First Missing Positive
    常见的几种单例模式
    分布式锁学习笔记
  • 原文地址:https://www.cnblogs.com/sevenyuan/p/2871616.html
Copyright © 2011-2022 走看看