How to use the three-nebula.CrossZone function in three-nebula

To help you get started, we’ve selected a few three-nebula examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github creativelifeform / three-nebula / website / components / Examples / CustomRenderer / init.js View on Github external
const createEmitter = zone => {
  const emitter = new Emitter();

  emitter
    .setRate(new Rate(new Span(4, 8), new Span(0.2, 0.5)))
    .addInitializers([
      new Mass(1),
      new Radius(100),
      new Life(2, 4),
      new RadialVelocity(400, new Vector3D(0, 1, 0), 60),
    ])
    .addBehaviours([
      new Rotate('random', 'random'),
      new Scale(1, 0.1),
      new Gravity(6),
      new CrossZone(zone, 'bound'),
      new Color(0xff0000, 'random', Infinity, ease.easeOutQuart),
    ])
    .setPosition({ x: 0, y: 0 })
    .emit();

  return emitter;
};