API Docs for: 0.0.2
Show:

Noise Class

Defined in: src\noise.js:18

A Noise Generator.

Constructor

Noise

(
  • width
  • height
)

Defined in src\noise.js:18

Parameters:

  • width Number
    • The image width.
  • height Number
    • The image height.

Item Index

Properties

Methods

generate

(
  • pattern
  • turbPower
  • turbSize
  • period0
  • period1
)
Uint8ClampedArray

Defined in src\noise.js:144

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

(
  • h
  • s
  • l
)
Array private

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

(
  • x
  • y
)
Number private

Defined in src\noise.js:83

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

(
  • x
  • y
  • size
)
Number private

Defined in src\noise.js:118

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

Defined in src\noise.js:40

The image height.

imageData

Uint8ClampedArray

Defined in src\noise.js:72

The noise image data (RGBA).

noise

Array private

Defined in src\noise.js:49

The noise image data.

Default: null

Pattern

Object final static

Defined in src\noise.js:3

Available noise patterns.

width

Number

Defined in src\noise.js:31

The image width.