three-nebula API
    Preparing search index...

    Class Force

    Behaviour that forces particles along a specific axis.

    Hierarchy (View Summary)

    Index
    • Constructs a Force behaviour instance.

      Parameters

      • Optionalfx: number

        the x axis force

      • Optionalfy: number

        the y axis force

      • Optionalfz: number

        the z axis force

      • Optionallife: number

        the life of the particle

      • Optionaleasing: EasingFunction

        The behaviour's decaying trend

      • isEnabled: boolean = true

        Determines if the behaviour will be applied or not

      Returns Force

    _life: number
    age: number
    dead: boolean
    energy: number
    force: Vector3D & { id: number }
    id: string
    isEnabled: boolean
    type: string
    • get life(): number

      Gets the behaviour's life.

      Returns number

    • set life(life: number): void

      Ensures that life is infinity if an invalid value is supplied.

      Parameters

      • life: number

      Returns void

    • Compares the age of the behaviour vs integration time and determines if the behaviour should be set to dead or not.

      Parameters

      • particle: Particle
      • time: number
      • Optionalindex: number

      Returns void

    • Returns a new instance of the behaviour from the JSON object passed.

      Parameters

      • json: Record<string, unknown>

      Returns void

    • Mutates the particle.acceleration property.

      Parameters

      • particle: Particle

        the particle to apply the behaviour to

      • time: number

        engine time

      • Optionalindex: number

        the particle index

      Returns void

    • Resets the behaviour properties.

      Parameters

      • Optionalfx: number

        the x axis force

      • Optionalfy: number

        the y axis force

      • Optionalfz: number

        the z axis force

      Returns void

    • Creates a Force initializer from JSON.

      Parameters

      • json: ForceJSON

        The JSON to construct the instance from.

      Returns Force