Home Reference Source
import ColorSpan from 'three-nebula/src/math/ColorSpan.js'
public class | source

ColorSpan

Extends:

Span → ColorSpan

Class for storing and interacting with an array of colours.

Constructor Summary

Public Constructor
public

constructor(colors: string | array<string>): *

Constructs a ColorSpan instance.

Member Summary

Public Members
public

colors: array<string>

An array of colors to select from

public

Determines if a random color should be returned from the getValue method.

public

The class type.

Method Summary

Public Methods
public

Gets a color from the color array or a random color if this.shouldRandomize is true.

Inherited Summary

From class Span
public

a: *

public

b: *

public

The class type.

private

_center: *

private
public

Span.getValue function

Public Constructors

public constructor(colors: string | array<string>): * source

Constructs a ColorSpan instance.

Override:

Span#constructor

Params:

NameTypeAttributeDescription
colors string | array<string>

A color or array of colors. If the string 'random' is provided, a random color will be returned from getValue

Return:

*

void

Public Members

public colors: array<string> source

An array of colors to select from

public shouldRandomize: boolean source

Determines if a random color should be returned from the getValue method.

public type: string source

The class type.

Override:

Span#type

Public Methods

public getValue(): string source

Gets a color from the color array or a random color if this.shouldRandomize is true.

Override:

Span#getValue

Return:

string

a hex color