babylon.quarks - v1.0.0
    Preparing search index...

    Class Gradient

    A colour that changes over time t in [0, 1] (a particle's life fraction, or the system's cycle): a gradient, or a random blend of two.

    Implements

    Index
    • Parameters

      • Optionalcolor: [Color3Like, number][]

        The colour keys: an RGB colour ({r, g, b}, such as a Babylon Color3) at a position in [0, 1]. Opaque white from 0 to 1 by default. The colours are copied.

      • Optionalalpha: [number, number][]

        The alpha keys: an alpha at a position in [0, 1]. 1 from 0 to 1 by default.

      Returns Gradient

    The alpha keys: alpha at positions in [0, 1], interpolated linearly.

    color: ContinuousLinearFunction<Vector3>

    The colour keys: linear RGB at positions in [0, 1], interpolated linearly.

    type: "function"

    'function': the colour depends on t.

    TABLE_SIZE: 257

    Sample count of the tables built by refreshTable.

    • Drops the sampled table, so later reads go back to evaluating the keys.

      Returns void

    • The colour at t (0 to 1) from the keys, as Unity's Gradient.Evaluate: for tools and UI that show a gradient. Returned as a new {r, g, b, a}.

      Parameters

      • t: number

      Returns Color4Like

    • The colour at t (0 to 1) written into target, such as a Babylon Color4, and returned.

      Type Parameters

      Parameters

      • t: number
      • target: T

      Returns T

    • Writes the colour at t into color.

      Parameters

      Returns Vector4

      color.

    • Evaluates the gradient keys themselves, ignoring any sampled table.

      Parameters

      • color: Vector4
      • t: number

      Returns Vector4

    • Rebuilds the sampled table when the gradient changed, otherwise does nothing. See PiecewiseBezier.refreshTable — same reasoning, and the same signature check so a gradient edited in an editor is picked up.

      Returns void

    • The sampled table genColor currently reads from, or null while none has been built. Lets a compiled behavior pass interpolate the table inline instead of calling in here once per particle.

      Returns Float32Array<ArrayBufferLike> | null