예제 #1
0
 /**
  * Creates an emitter that supports up to {@code maxParticles} particles at any one time.
  *
  * @param image the image to use for each particle.
  * @param onLayer the layer to which to add the layer which will render the particles.
  */
 public Emitter createEmitter(int maxParticles, Image image, GroupLayer onLayer) {
   final Emitter emitter = new Emitter(this, maxParticles, image);
   emitter._conn =
       _onPaint.connect(
           new Slot<Now>() {
             public void onEmit(Now now) {
               emitter.update(now.time, now.dt);
             }
           });
   onLayer.add(emitter.layer);
   return emitter;
 }
예제 #2
0
 protected Emitter createEmitter(
     ParticleBatch batch, Randoms rando, Tile tile, int color, float drag) {
   final Emitter explode = new Emitter(batch, paint, 200, tile);
   explode.generator = Generator.impulse(200);
   explode.initters.add(Lifespan.random(rando, 1, 1.5f));
   explode.initters.add(Color.constant(color));
   // explode.initters.add(Color.constant(0xFFF06969));
   explode.initters.add(Transform.layer(explode.layer));
   explode.initters.add(Velocity.randomNormal(rando, 0, 70));
   explode.initters.add(Velocity.increment(0, 10));
   explode.effectors.add(Alpha.byAge(Interpolator.EASE_IN));
   explode.effectors.add(new Gravity(30));
   // explode.effectors.add(new Drag(0.95f));
   explode.effectors.add(new Drag(drag));
   explode.effectors.add(new Move());
   return explode;
 }
예제 #3
0
 @Override
 public void hideTransitionStarted() {
   super.hideTransitionStarted();
   for (Emitter emitter : _emitters) emitter.destroy();
   _emitters.clear();
 }