three-nebula API
    Preparing search index...

    Class CurlNoise

    Behaviour that drives particles with the curl of a seeded noise field — the standard for organic, roiling turbulence (smoke, fire, dust, energy). Because the field is the curl of a vector potential it is divergence-free, so particles swirl and fold without clumping or thinning.

    Like Vortex, it is applied to the particle's velocity (not acceleration), so it is not subject to the Force 1:100 (MEASURE) scaling. It is deterministic: the field is built once from seed via the seeded PRNG (spec 02's mulberry32), never Math.random, so the same seed yields the same flow on every machine.

    Hierarchy (View Summary)

    Index
    • Constructs a CurlNoise behaviour instance.

      Parameters

      • scale: number = DEFAULT_CURL_NOISE_SCALE

        Spatial frequency of the field (samples position × scale)

      • strength: number = DEFAULT_CURL_NOISE_STRENGTH

        Velocity magnitude imparted by the field

      • seed: number = DEFAULT_CURL_NOISE_SEED

        Seed for the (deterministic) noise field

      • life: number = DEFAULT_LIFE

        The life of the behaviour

      • easing: EasingFunction = DEFAULT_BEHAVIOUR_EASING

        The behaviour's decaying trend

      • isEnabled: boolean = true

        Determines if the behaviour will be applied or not

      Returns CurlNoise

    _life: number
    age: number
    dead: boolean
    energy: number
    id: string
    isEnabled: boolean
    scale: number
    seed: number
    strength: 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's velocity by the curl of the noise field.

      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

      • scale: number = DEFAULT_CURL_NOISE_SCALE
      • strength: number = DEFAULT_CURL_NOISE_STRENGTH
      • seed: number = DEFAULT_CURL_NOISE_SEED
      • Optionallife: number
      • Optionaleasing: EasingFunction

      Returns void