RSX Code Reference
    Preparing search index...
    • rsx
    • LinearColor

    Class LinearColor

    The LinearColor implements a color in linear color space. The class follows the 'copy-on-write' pattern, which means that every operation such as LinearColor.divideScalar or LinearColor.multiply returns a copy of the color with updated values. It also implies that the values of the color cannot be directly modified.

    The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.

    Index
    • Parameters

      • Optionalr: number
      • Optionalg: number
      • Optionalb: number
      • Optionala: number

      Returns LinearColor

    _a: number
    _b: number
    _g: number
    _r: number
    • get a(): number

      Returns number

    • set a(value: number): void

      Parameters

      • value: number

      Returns void

    • get b(): number

      Returns number

    • set b(value: number): void

      Parameters

      • value: number

      Returns void

    • get elementCount(): number

      Gets the number of elements in this color.

      Returns number

    • get g(): number

      Returns number

    • set g(value: number): void

      Parameters

      • value: number

      Returns void

    • get r(): number

      Returns number

    • set r(value: number): void

      Parameters

      • value: number

      Returns void

    • Clones this instance and returns a new LinearColor with identical values.

      Returns LinearColor

    • Returns a copy of the current color divided by a factor.

      Parameters

      • factor: number

      Returns LinearColor

    • Divides this color by a factor.

      Parameters

      • factor: number

      Returns LinearColor

    • Performs scalar multiplication of this color and returns it.

      Parameters

      • factor: number
      • multiplyAlpha: boolean

      Returns LinearColor

    • Accesses color components by an index.

      Parameters

      • index: number

        Index ranging [0, 3]

      Returns number

      Value of the component at the specified index.

    • Returns whether the provided color, given a error margin, has the same color components values as this one.

      Parameters

      • rhs: Immutable<LinearColor>

        The other Color to compare with.

      • Optionalepsilon: number

        Optional. Error margin within which the numbers should be considered equal.

      Returns boolean

      True if equal, false otherwise.

    • Returns whether the given color contains the same color components values as this one.

      Parameters

      Returns boolean

    • Returns a copy of this color multiplied by the factor.

      Parameters

      • factor: number
      • multiplyAlpha: boolean

      Returns LinearColor

    • Assigns the value to the element at the specified index.

      Parameters

      • index: number
      • value: number

      Returns void

    • Converts the current color to a Color.

      Returns Color

      No color space conversion is perfomed.

    • Converts the current color from linear to SRGB colorspace and returns the result.

      Returns SRGBColor

    • Returns a string representation of an object.

      Returns string

    • Converts this instance to a Vector3 with R/G/B while ignoring the alpha value.

      Returns Vector3

    • Compares two colors with an error margin.

      Parameters

      • lhs: Immutable<LinearColor>

        First color to compare.

      • rhs: Immutable<LinearColor>

        Second color to compare.

      • Optionalepsilon: number

        Optional. Error margin within which the numbers should be considered equal.

      Returns boolean

      True if equal, false otherwise.