Noise Class
A Noise Generator.
Constructor
Noise
(
-
width
-
height
Parameters:
-
width
Number- The image width.
-
height
Number- The image height.
Item Index
Methods
Methods
generate
(
Uint8ClampedArray
-
pattern
-
turbPower
-
turbSize
-
period0
-
period1
Generates noise image data.
Parameters:
-
pattern
Pattern- The pattern.
-
turbPower
Number- Intensity of the twists. 0 creates a normal sine pattern.
-
turbSize
Number- Initial size of the turbulence.
-
period0
Number- Repetition of marble lines in x direction. Only relevant for the marble and wood patterns.
-
period1
Number- Repetition of marble lines in y direction. Only relevant for the marble pattern.
Returns:
Uint8ClampedArray:
The generated image data.
hslToRgb
(
Array
private
-
h
-
s
-
l
Converts an HSL color value to RGB. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. Assumes h, s, and l are contained in the set [0, 1] and returns r, g, and b in the set [0, 255].
Parameters:
-
h
Number- The hue.
-
s
Number- The saturation.
-
l
Number- The lightness.
Returns:
Array:
The RGB representation.
smooth
(
Number
private
-
x
-
y
Smoothes the noise data.
Parameters:
-
x
Number- X coordinate in noise data.
-
y
Number- Y coordinate in noise data.
Returns:
Number:
The smoothed noise value at xy.
turbulence
(
Number
private
-
x
-
y
-
size
Creates turbulences on the noise data.
Parameters:
-
x
Number- X coordinate in noise data.
-
y
Number- Y coordinate in noise data.
-
size
Number- Turbulence size.
Returns:
Number:
The turbulence noise value for xy.
Properties
height
Number
The image height.
imageData
Uint8ClampedArray
The noise image data (RGBA).
noise
Array
private
The noise image data.
Default: null
Pattern
Object
final
static
Available noise patterns.
width
Number
The image width.