-
Notifications
You must be signed in to change notification settings - Fork 0
Color class
Represents an RGB color. It can decay into a CSS color string for use with an HTML5 Canvas.
let clr = new Color(Number red, Number green, Number blue)
Returns a new Color object with the given red, green, and blue values.
clr.red -> Number
The red component of the color. May be modified directly.
clr.green -> Number
The green component of the color. May be modified directly.
clr.blue -> Number
The blue component of the color. May be modified directly.
clr.trunc() -> Color
Converts the red, green, and blue components into integers. No rounding is performed, instead the decimal part is simply truncated off. Returns a reference to the modified clr.
String(clr)
Returns the CSS color representation of clr. Each of the color components must be positive 8-bit integers (0 to 255 inclusive).
Color.lerp(Color from, Color to, Number pos) -> Color
Linearly interpolates between from and to by pos and returns the result as a new Color. pos is clamped to the range 0 to 1 inclusive.