module:extras/gradients
The extras/gradients.js
module.
To import all symbols in this module, either of the following can be used:
import * from "extras/gradients.js"; // -- or -- import * as CustomModuleName from "extras/gradients.js";
Methods
- horizontalGradient
Generates a 32 × 32 bitmap of a linear gradient in the horizontal direction. - loadTga
Loads an image from data in TGA format. - radialGradient
Generates a 32 × 32 bitmap of a radial gradient.
### (static) module:extras/gradients.horizontalGradient(color1, color2)
Generates a 32 × 32 bitmap of a linear gradient in the horizontal direction. This function demonstrates generating a custom texture.
Parameters
-
color1
(Type: Array.<number>number string)
A color vector or string identifying the color at the left edge of the gradient. -
color2
(Type: Array.<number>number string)
A color vector or string identifying the color at the right edge of the gradient.
Return Value
An array with 32 × 32 × x bytes, arranged in 32 rows of 32 pixels of 4 bytes each. For each pixel, the four bytes are color components in the following order: red, green, blue, alpha. (Type: UInt8Array)
### (static) module:extras/gradients.loadTga(data)
Loads an image from data in TGA format.
Parameters
data
(Type: UInt8Array)
Image data in TGA format
Return Value
An array with 32 × 32 × x bytes, arranged in 32 rows of 32 pixels of 4 bytes each. For each pixel, the four bytes are color components in the following order: red, green, blue, alpha. (Type: UInt8Array)
### (static) module:extras/gradients.radialGradient(colorCenter, colorEdges)
Generates a 32 × 32 bitmap of a radial gradient. This function demonstrates generating a custom texture.
Parameters
-
colorCenter
(Type: Array.<number>number string)
A color vector or string identifying the color at the center of the gradient. -
colorEdges
(Type: Array.<number>number string)
A color vector or string identifying the color at the edges of the gradient.
Return Value
An array with 32 × 32 × x bytes, arranged in 32 rows of 32 pixels of 4 bytes each. For each pixel, the four bytes are color components in the following order: red, green, blue, alpha. (Type: UInt8Array)