Description
A class containing rgba values for an object's color.
Properties
a |
The color's alpha component. |
b |
The color's blue component. |
g |
The color's green component. |
r |
The color's red component. |
Methods
lerp |
Linearly interpolates between two colors. |
Constructor
Color |
Constructs a color by rgba component values. |
Static Properties
Static Methods
byNumber |
Returns a color by a uniquely identifying number. |
fromPalette |
Returns a color from a color palette. |
random |
Returns a random color. |
Operators
- |
Substracts one color from another. |
!= |
Compares two colors. |
* |
Multiplies a color by another color or a scale factor. |
/ |
Divides a color by a factor. |
+ |
Adds two colors together. |
+= |
Assigns the color to be the sum of two colors. |
-= |
Assigns the color to be the difference of two colors. |
== |
Compares two colors. |
Details
Do no remove, this fixes the anchor on doc.flexsim.com
double a
Description
The color's alpha component.
Color components are in the range 0-1
Do no remove, this fixes the anchor on doc.flexsim.com
double b
Description
The color's blue component.
Color components are in the range 0-1
Do no remove, this fixes the anchor on doc.flexsim.com
double g
Description
The color's green component.
Color components are in the range 0-1
Do no remove, this fixes the anchor on doc.flexsim.com
double r
Description
The color's red component.
Color components are in the range 0-1
Do no remove, this fixes the anchor on doc.flexsim.com
Parameters
targetColor |
The color to interpolate to. |
t |
A ratio between 0 and 1 that defines the percentage to interpolate from the current color to targetColor. |
Returns
Color
|
The resulting interpolated color. |
Description
Linearly interpolates between two colors.
The following example code changes current's color 20% toward red.
current.color = current.color.lerp(Color.red, 0.2);
Do no remove, this fixes the anchor on doc.flexsim.com
Color Constructor
Parameters
r |
The red component, in the range 0-1. |
g |
The green component, in the range 0-1. |
b |
The blue component, in the range 0-1. |
a |
The alpha component, in the range 0-1. |
Description
Constructs a color by rgba component values.
current.color = Color(0.1, 0.6, 0.3);
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color aqua
Description
An aqua color
current.color = Color.aqua;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color black
Description
A black color
current.color = Color.black;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color blue
Description
A blue color
current.color = Color.blue;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color brown
Description
A brown color
current.color = Color.brown;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color gray
Description
A gray color
current.color = Color.gray;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color green
Description
A green color
current.color = Color.green;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color lightBlue
Description
A light blue color
current.color = Color.lightBlue;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color lime
Description
A lime color
current.color = Color.lime;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color orange
Description
An orange color
current.color = Color.orange;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color pink
Description
A pink color
current.color = Color.pink;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color purple
Description
A purple color
current.color = Color.purple;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color red
Description
A red color
current.color = Color.red;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color silver
Description
A silver color
current.color = Color.silver;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color teal
Description
A teal color
current.color = Color.teal;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color white
Description
A white color
current.color = Color.white;
Do no remove, this fixes the anchor on doc.flexsim.com
static readonly Color yellow
Description
A yellow color
current.color = Color.yellow;
Do no remove, this fixes the anchor on doc.flexsim.com
Color.byNumber()
Parameters
number |
The identifying number. |
Returns
Color
|
The resulting color. |
Description
Returns a color by a uniquely identifying number.
item.color = Color.byNumber(item.labelVal);
The number passed in refers to an index in the standard colors spectrum, as follows:
1 - red
2 - green
3 - blue
4 - yellow
5 - orange
6 - purple
7 - lime
8 - pink
9 - gray
10 - teal
11 - aqua
12 - brown
13 - light blue
14 - silver
15 - white
For numbers above 15, a unique color will generated based on an algorithm.
Do no remove, this fixes the anchor on doc.flexsim.com
Color.fromPalette()
Parameters
value |
The value to get a color for. |
palette |
The Color Palette to get a color from. |
Returns
Color
|
The resulting color. |
Description
Returns a color from a color palette.
A palette can either be specified by name or
by node. The color palette will look up the color
assigned to the given value, asserting a color for the
value if necessary. However, if the palette
is using a gradient, the palette will linearly interpolate
between the color values already defined by the palette.
If no palette is specified, then the resulting color will
be generated using the given value.
Do no remove, this fixes the anchor on doc.flexsim.com
Parameters
stream |
The random number stream to use. |
Returns
Color
|
The resulting color. |
Description
Returns a random color.
current.color = Color.random();
Do no remove, this fixes the anchor on doc.flexsim.com
Color.operator -
Parameters
other |
The color to subtract from this color. |
Returns
Color
|
The resulting color. |
Description
Substracts one color from another.
Resulting components will be clamped to the range 0-1.
current.color = Color.aqua - Color.red;
Do no remove, this fixes the anchor on doc.flexsim.com
Color.operator !=
Parameters
other |
The color to compare to this color. |
Returns
int
|
True if the two colors are different, false otherwise. |
Description
Compares two colors.
int isNotRed = current.color != Color.red;
Do no remove, this fixes the anchor on doc.flexsim.com
Color.operator *
Parameters
other |
The color to multiply this color by. |
factor |
A scale factor to multiply each component by. |
Returns
Color
|
The resulting color. |
Description
Multiplies a color by another color or a scale factor.
When a Color is passed, the operation will perform per-component multiplication.
Resulting components will be clamped to the range 0-1.
current.color = Color.aqua * Color.red;
current.color = Color.aqua * 1.2;
Do no remove, this fixes the anchor on doc.flexsim.com
Color.operator /
Parameters
factor |
The factor to divide each component by. |
Returns
Color
|
The resulting color. |
Description
Divides a color by a factor.
current.color = Color.aqua / 2;
Do no remove, this fixes the anchor on doc.flexsim.com
Color.operator +
Parameters
other |
The color to add this one to. |
Returns
Color
|
The resulting color. |
Description
Adds two colors together.
Resulting components will be clamped to the range 0-1.
current.color = Color.blue + Color.red;
Do no remove, this fixes the anchor on doc.flexsim.com
Color.operator +=
Parameters
other |
The color to add this one to. |
Returns
Color
|
The resulting color and assigns it to the variable. |
Description
Assigns the color to be the sum of two colors.
Resulting components will be clamped to the range 0-1.
current.color += Color.blue;
Do no remove, this fixes the anchor on doc.flexsim.com
Color.operator -=
Parameters
other |
The color to subtract from this one. |
Returns
Color
|
The resulting color and assigns it to the variable. |
Description
Assigns the color to be the difference of two colors.
Resulting components will be clamped to the range 0-1.
current.color -= Color.blue;
Do no remove, this fixes the anchor on doc.flexsim.com
Color.operator ==
Parameters
other |
The color to compare to this color. |
Returns
int
|
True if the two colors are exactly the same, false otherwise. |
Description
Compares two colors.
int isRed = current.color == Color.red;