Options
All
  • Public
  • Public/Protected
  • All
Menu

A single particle whose lifecycle is controlled by a ParticleEmitter.

Can be used alone if desired as a randomly moving and fading entity.

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

alpha

alpha: number

The opacity of the entity (from 0 to 1)

children

children: Partial<Entity>[]

An array of child entities for recursive update/render.

dead

dead: boolean

Whether or not the entity is dead.

pos

pos: Vec

Position of the entity.

scale

scale: Vec

Scale of the entity.

visible

visible: boolean

Whether or not the entity is visible.

Accessors

hasChildren

  • get hasChildren(): boolean

Methods

add

  • add<T>(child: T): T
  • Add and return a child object.

    Type parameters

    • T

    Parameters

    • child: T

      Object to add to the container.

    Returns T

map

  • map(fn: (child: Partial<Entity>, index?: number) => void): any
  • Map a function across all children.

    Parameters

    • fn: (child: Partial<Entity>, index?: number) => void

      Function to call for each child.

        • (child: Partial<Entity>, index?: number): void
        • Parameters

          • child: Partial<Entity>
          • Optional index: number

          Returns void

    Returns any

remove

  • remove<T>(child: T): T
  • Remove and return a child object.

    Type parameters

    • T

    Parameters

    • child: T

      Object to remove from the container.

    Returns T

reset

  • reset(): void
  • Reset the particle with random values within established ranges.

    Returns void

update

  • update(dt: number): void
  • Update state of the particle.

    Exits early if the particle's time is up.

    Parameters

    • dt: number

      Delta time since last update.

    Returns void