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();
  • 相关阅读:
    Java Web(八) MVC和三层架构
    Java Web(九) 用户管理系统
    Java Web(十一) 分页功能的实现
    hibernate(四) 双向多对多映射关系
    合并两个排序的链表
    反转链表
    链表中倒数第k个结点
    堆排序
    计算机网络常见面试题
    字节对齐原则
  • 原文地址:https://www.cnblogs.com/sevenyuan/p/2871616.html
Copyright © 2011-2022 走看看