omega-game-engine
    Preparing search index...

    Class Color

    A class representing a color using RGBA values, backed by a gl-matrix vec4. This class provides methods for manipulating and converting colors.

    Hierarchy (View Summary)

    Indexable

    • [key: string]: any
    Index

    Constructors

    • Creates an instance of Color.

      Parameters

      • Optionalr: number = 1

        The red component.

      • Optionalg: number = 1

        The green component.

      • Optionalb: number = 1

        The blue component.

      • Optionala: number = 1

        The alpha component.

      Returns Color

    Properties

    _className: string
    _serializationIgnoreKeys: string[]
    _uuid: string
    name: string = ''

    Accessors

    • get a(): number

      Gets the alpha component of the color.

      Returns number

    • set a(value: number): void

      Sets the alpha component of the color.

      Parameters

      • value: number

        The new alpha value.

      Returns void

    • get b(): number

      Gets the blue component of the color.

      Returns number

    • set b(value: number): void

      Sets the blue component of the color.

      Parameters

      • value: number

        The new blue value.

      Returns void

    • get g(): number

      Gets the green component of the color.

      Returns number

    • set g(value: number): void

      Sets the green component of the color.

      Parameters

      • value: number

        The new green value.

      Returns void

    • get r(): number

      Gets the red component of the color.

      Returns number

    • set r(value: number): void

      Sets the red component of the color.

      Parameters

      • value: number

        The new red value.

      Returns void

    Methods

    • Sets the RGBA values of the color.

      Parameters

      • Optionalr: number = 1

        The red component.

      • Optionalg: number = 1

        The green component.

      • Optionalb: number = 1

        The blue component.

      • Optionala: number = 1

        The alpha component.

      Returns void

    • Converts the color to a gl-matrix vec3.

      Returns vec3

      • A new vec3 containing the RGB components.
    • Returns the internal gl-matrix vec4.

      Returns vec4

      • The vec4 containing the RGBA components.
    • Linearly interpolates between two colors.

      Parameters

      • a: Color

        The starting color.

      • b: Color

        The ending color.

      • t: number

        The interpolation factor (0 to 1).

      Returns Color

      • The new, interpolated color.