three-nebula API
    Preparing search index...

    Class RandomDrift

    Behaviour that causes particles to drift to random coordinates in 3D space.

    Hierarchy (View Summary)

    Index
    • Constructs a RandomDrift behaviour instance.

      Parameters

      • driftX: number

        x axis drift

      • driftY: number

        y axis drift

      • driftZ: number

        z axis drift

      • delay: number = DEFAULT_RANDOM_DRIFT_DELAY

        drift delay

      • Optionallife: number

        The life of the particle

      • Optionaleasing: EasingFunction

        The behaviour's decaying trend

      • isEnabled: boolean = true

      Returns RandomDrift

    _life: number
    age: number
    dead: boolean
    delayPan: Span<number>
    energy: number
    id: string
    isEnabled: boolean
    randomForce: Vector3D
    time: number
    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

      • driftX: number

        x axis drift

      • driftY: number

        y axis drift

      • driftZ: number

        z axis drift

      • delay: number = DEFAULT_RANDOM_DRIFT_DELAY

        drift delay

      • Optionallife: number

        The life of the particle

      • Optionaleasing: EasingFunction

        The behaviour's decaying trend

      Returns void