Fractal Noise
Fractal noise library
Install
npm install fractal-noise
Examples
generateCylinder(width, height, { frequency: 0.04, octaves: 2 })
generateCylinder(width, height, { frequency: 0.06, octaves: 8 })
generateLine(width)
generateLine(width, { frequency: 0.1 })
generateRectangle(width, height)
generateRectangle(width, height, { frequency: 0.04, octaves: 8 })
API
Options
The options
object for each generate
function contains the following properties:
amplitude?: number
– Defaults to 1.0
frequency?: number
– Defaults to 1.0
octaves?: number
– Defaults to 1
persistence?: number
– Defaults to 0.5
generateCylinder (circumference: number, height: number, options: Options = {}): Uint8Array[]
Generates a two-dimensional noise field formed around a three-dimensional cylinder, such that it is continuous across the x-boundaries.
generateLine (length: number, options: Options = {}): number[]
Generates a one-dimensional noise field.
generateRectangle (width: number, height: number, options: Options = {}): Uint8Array[]
Generates a two-dimensional noise field isolated to width
and height
(non-continuous noise).