mwg API
    Preparing search index...

    Class Beams

    Owns the beams a game has flashing: one add per ray, one update(dt) fading them all and forgetting the finished ones, and no bookkeeping left to the caller. Beams are parented here and destroyed with their beam; z-order stays the caller's.

    import { Beams } from '@datamoc/mwg/two-d/render';
    import type { Container2D } from '@datamoc/mwg/two-d/render';

    declare const layer: Container2D;

    const beams = new Beams();
    layer.addChild(beams);

    beams.add({ x: 0, y: 0 }, { x: 100, y: 0 }, { colour: 0x88ccff });
    beams.update(1 / 60);
    console.log(beams.count); // 1 - still fading
    beams.clear();

    Hierarchy

    • Container
      • Beams
    Index
    • Parameters

      • Optionaloptions: ContainerOptions<ContainerChild>

      Returns Beams

    • Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

      Returns void

      container.destroy();
      container.destroy(true);
      container.destroy({ children: true });
      container.destroy({ children: true, texture: true, textureSource: true });
    • fades every live beam, then forgets and destroys the finished ones

      Parameters

      • dt: number

      Returns void