three-nebula API
    Preparing search index...

    Class Repulsion

    Behaviour that causes particles to be repelled from a target position.

    Hierarchy (View Summary)

    Index
    • Constructs an Repulsion behaviour instance.

      Parameters

      • targetPosition: Vector3D

        The position the particles will be repelled from

      • force: number

        The repulsion force scalar multiplier

      • radius: number

        The repulsion radius

      • Optionallife: number

        The life of the particle

      • Optionaleasing: EasingFunction

        The behaviour's decaying trend

      • isEnabled: boolean = true

      Returns Repulsion

    _life: number
    age: number
    attractionForce: Vector3D
    dead: boolean
    energy: number
    force: number
    id: string
    isEnabled: boolean
    lengthSq: number
    radius: number
    radiusSq: number
    targetPosition: Vector3D
    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 particle acceleration.

      Parameters

      • particle: Particle

        the particle to apply the behaviour to

      • time: number

        particle engine time

      • Optionalindex: number

        the particle index

      Returns void

    • Resets the behaviour properties.

      Parameters

      • targetPosition: Vector3D

        the position the particles will be attracted to

      • force: number

        the attraction force multiplier

      • radius: number

        the attraction radius

      • Optionallife: number

        the life of the particle

      • Optionaleasing: EasingFunction

        The behaviour's decaying trend

      Returns void