three-nebula API
    Preparing search index...

    Class Gravity

    Behaviour that forces particles down the y axis.

    Hierarchy (View Summary)

    Index
    • Constructs a Gravity behaviour instance.

      Parameters

      • gravity: number

        the force to pull the particle down the y axis

      • Optionallife: number

        the life of the particle

      • Optionaleasing: EasingFunction

        the easing equation to use

      • isEnabled: boolean = true

        Determines if the behaviour will be applied or not

      Returns Gravity

    _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