module:extras/gradients

Back to documentation index.

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

(static) module:extras/gradients.horizontalGradient(color1, color2)

Generates a 32x32 bitmap of a linear gradient in the horizontal direction. This function demonstrates generating a custom texture.

Parameters

Return Value

An array with 32x32x4 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 32x32 bitmap of a radial gradient. This function demonstrates generating a custom texture.

Parameters

Return Value

An array with 32x32x4 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)

Back to documentation index.