A noise generator inspired by the P5.js noise engine
png5 stands for perlin noise generator but it does not provide only perlin noise !
- Undetermined random
- Determined random
- White noise
- Pink noise - Perlin noise
- Brownian noise- Cellular noise
Features
- Light weight
- Easy to use
Installation
npm install png5 --save
Usage
- Using the generator with Node :
// Importconst NoiseGenerator = // Initialize and config at the same timeconst myNoiseMachine = lod: 2 falloff: 025 seed: 'seed' // Initialize and config laterconst myNoiseMachine = myNoiseMachinemyNoiseMachine // By default the noise generator noise detail lod is set to 4 and falloff to 0.5// If no seed is provided, the generator will use a random string // Get a 1D noise at index xconst noise1D = myNoiseMachine // Get a 2D noise at x,y coordinatesconst noise2D = myNoiseMachine // Get a 3D noise at x,y,z coordinatesconst noise3D = myNoiseMachine
Methods of the noise generator class
x / Number: x-coordinate in noise space (Optional)
If no parameter is passed to the function it return an undetermined random number
x / Number: x-coordinate in noise space
y / Number: y-coordinate in noise space (Optional)
z / Number: z-coordinate in noise space (Optional)
x / Number: x-coordinate in noise space
y / Number: y-coordinate in noise space (Optional)
z / Number: z-coordinate in noise space (Optional)
lod / Number: number of octaves to be used by the noise
falloff / Number: falloff factor for each octave
seed / Number: the seed value