Construct a LUT object, specifying any amount of its properties.
Example 1, LUT with interpolation disabled.
const lut = new LUT({
steps: [
{ value: 0, color: ColorRGBA( 0, 0, 0 ) },
{ value: 10, color: ColorRGBA( 255, 0, 0 ) },
{ value: 100, color: ColorRGBA( 0, 255, 0 ) }
],
interpolate: false
})
Example 2, LUT with interpolation enabled.
const lut = new LUT({
steps: [
{ value: 0, color: ColorRGBA( 0, 0, 0 ) },
{ value: 10, color: ColorRGBA( 255, 0, 0 ) },
{ value: 100, color: ColorRGBA( 0, 255, 0 ) }
],
interpolate: true
})
Get the color associated with the given value.
Example:
const color = lut.getColors( 5 )
Single value.
Associated color if the LUT is valid, otherwise fallback color.
Get the colors associated with the given collection of values.
Example:
const colors = lut.getColors( [ 5, 10, 15 ] )
1D collection of value.
Collection of associated colors if the LUT is valid, otherwise fallback colors.
Get the colors associated with the given collection Matrix2D of values.
Example:
const colors = lut.getColors(
[
[ 3, 7, 9 ],
[ 5, 10, 15 ]
]
)
2D collection of values.
Collection of associated colors if the LUT is valid, otherwise fallback colors.
Get fallback color of value the LUT.
Color object.
Get interpolation behavior of the LUT.
Intepolation behaviour state. True - gradient, False - uniform.
Get collection of LUT steps.
Collection of steps.
Get title of the LUT.
Title of the LUT as string.
Get units of the LUT.
Units of the LUT as string.
Set fallback color. The following color would be used as a backup. Meaning, the LUT might be configured incorrectly or the data is incorrect.
Color object.
Set interpolation behavior of the LUT, which describes the distribution of color for the data:
Interpolation behavior: True - gradient, False - uniform.
Set new collection of LUT steps.
Collection of color-value pairs.
Set title of the LUT, which describes the data.
Title of the LUT.
Set units of the data-values in the LUT, which describes the data domain.
Units of the LUT.
Unlike other types in Immutable.js, the Record()
function creates a new
Record Factory, which is a function that creates Record instances.
See above for examples of using Record()
.
Note: Record
is a factory function and not a class, and does not use the
new
keyword during construction.
Records allow passing a second parameter to supply a descriptive name that appears when converting a Record to a string or in any error messages. A descriptive name for any record can be accessed by using this method. If one was not provided, the string "Record" is returned.
const { Record } = require('immutable')
const Person = Record({
name: null
}, 'Person')
var me = Person({ name: 'My Name' })
me.toString() // "Person { "name": "My Name" }"
Record.getDescriptiveName(me) // "Person"
True if maybeRecord
is an instance of a Record.
Style class for describing a table of colors with associated lookup values (numbers).
Instances of LUT, like all LCJS style classes, are immutable, meaning that its setters don't modify the actual object, but instead return a completely new modified object.
Properties of LUT:
steps
: List of color steps (color + number value pair).interpolate
:true
enables automatic linear interpolation between color steps.LUT Behavior:
Example 1, LUT with interpolation disabled.
const lut = new LUT({ steps: [ { value: 0, color: ColorRGBA( 0, 0, 0 ) }, { value: 10, color: ColorRGBA( 255, 0, 0 ) }, { value: 100, color: ColorRGBA( 0, 255, 0 ) } ], interpolate: false })
Example 2, LUT with interpolation enabled.
const lut = new LUT({ steps: [ { value: 0, color: ColorRGBA( 0, 0, 0 ) }, { value: 10, color: ColorRGBA( 255, 0, 0 ) }, { value: 100, color: ColorRGBA( 0, 255, 0 ) } ], interpolate: true })
LUT Usage:
Use LUT with: