noise.js
a javascript simple noise generator based on code from from scratchapixel.com, via Michael Bromley
Installation
npm install yy-noise
API Reference
creates simple 1D noise this.generator
Kind: global class
new SimpleNoise(options, [maxVertices], [amplitude], [scale])
| Param | Type | Default |
|---|---|---|
| options | object |
|
| [maxVertices] | number |
256 |
| [amplitude] | number |
1 |
| [scale] | number |
1 |
Example
const noise = new SimpleNoise({maxVertices: 512, noise: 0.5, scale: 0.25});
// changes amplitude of noise function
noise.amplitude = amplitude;
// sets scale of noise function
noise.scale = scale;
// returns the value based on n (usually incremented along an axis)
for (let x = 0; x < 100; x++)
{
noise.get(n);
}
simpleNoise.get(x) ⇒ number
gets a value
Kind: instance method of SimpleNoise
| Param | Type |
|---|---|
| x | number |
simpleNoise.lerp(a, b, t) ⇒ number
Linear interpolation function.
Kind: instance method of SimpleNoise
| Param | Type | Description |
|---|---|---|
| a | number |
The lower integer value |
| b | number |
The upper integer value |
| t | number |
The value between the two |
Copyright (c) 2016 YOPEY YOPEY LLC - MIT License - Documented by jsdoc-to-markdown