How to use the three-nebula.BoxZone 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 / MeshRenderer / init.js View on Github external
const createEmitter = ({ position, body }) => {
  const emitter = new Emitter();

  return emitter
    .setRate(new Rate(new Span(5, 10), new Span(0.1, 0.25)))
    .addInitializers([
      new Mass(1),
      new Radius(10),
      new Life(2, 4),
      new Body(body),
      new Position(new BoxZone(100)),
      new RadialVelocity(200, new Vector3D(0, 1, 1), 30),
    ])
    .addBehaviours([
      new Rotate('random', 'random'),
      new Scale(1, 0.1),
      new Gravity(3),
    ])
    .setPosition(position)
    .emit();
};
github creativelifeform / three-nebula / website / components / Examples / SpriteRendererSnow / init.js View on Github external
const createEmitter = (camera, renderer) => {
  const emitter = new Emitter();
  const position = new Position();

  position.addZone(new BoxZone(2500, 10, 2500));

  return emitter
    .setRate(new Rate(new Span(34, 48), new Span(0.2, 0.5)))
    .addInitializers([
      new Mass(1),
      new Radius(new Span(10, 20)),
      position,
      new Life(5, 10),
      new Body(createSnow()),
      new RadialVelocity(0, new Vector3D(0, -1, 0), 90),
    ])
    .addBehaviours([
      new RandomDrift(10, 1, 10, 0.05),
      new Rotate('random', 'random'),
      new Gravity(2),
      new CrossZone(new ScreenZone(camera, renderer, 20, '234'), 'dead'),
github creativelifeform / three-nebula / website / components / Examples / CustomRenderer / init.js View on Github external
const createZone = () => {
  const zone = new BoxZone(600);

  zone.friction = 0.95;
  zone.max = 7;

  return zone;
};