Class ColorGradient

Represents a range of color values over some parameters, similar to a curve. Internally represented as a set of keys that get interpolated between. Stores colors as 32-bit integers, and is therefor unable to represent a color range outside of [0, 1] - see ColorGradientHDR for an alternative.

Hierarchy

  • FrameworkObject
    • ColorGradient

Constructors

  • Performs Alloc.

    Parameters

    • Optionaloptions: {
          color: Immutable<Color>;
      } | {
          duration?: number;
          keys: readonly Immutable<ColorGradientKey>[];
      }

      Options object for the function call.

    • OptionalisInternalConstructor: boolean

    Returns ColorGradient

Accessors

  • get duration(): number
  • Returns the duration over which the gradient values are interpolated over. Corresponds to the time value of the final keyframe.

    Returns number

  • set duration(value): void
  • Parameters

    • value: number

    Returns void

  • get isOpaque(): boolean
  • Determines if all color values have an alpha value of at least 1.0f

    Returns boolean

  • get keyCount(): number
  • Returns the number of color keys in the gradient.

    Returns number

Methods

  • Evaluates a color at the specified t.

    Parameters

    • t: number

    Returns Color

  • Returns the color key at the specified index. If out of range an empty key is returned.

    Parameters

    • idx: number

    Returns ColorGradientKey

  • Specify a "gradient" that represents a single color value.

    Parameters

    Returns void

  • Sets the gradient keys.

    Parameters

    • keys: Immutable<ColorGradientKey>[]

      The gradient keys.

    • duration: number

      Optional, the duration of the gradient. If not set, the duration is inferred from the time of the keys.

    Returns void