Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 868 Bytes

README.md

File metadata and controls

48 lines (33 loc) · 868 Bytes

perlin-fp

A fluent functional 3-dimensional Perlin noise generator based on p5.js Perlin noise implementation


Install

npm i -S perlin-fp

# with yarn
# yarn add perlin-fp

Examples

Basic (random seed)

const perlinNoise = require('perlin-fp');
const { getNoiseByCoordinate } = perlinNoise();
const [x, y, z] = [0, 0, 0];

getNoiseByCoordinate(x, y, z);
// -> 0.5324108156492002

getNoiseByCoordinate(x, y, z);
// -> 0.7722926216956694

With all options

const perlinNoise = require('perlin-fp');
const { getNoiseByCoordinate } = perlinNoise()
  .setSeed(1)
  .setOctaves(4)
  .setAmpFallOff(0.5);
const [x, y, z] = [0, 0, 0];

getNoiseByCoordinate(x, y, z);
// -> 0.22167705494211987

getNoiseByCoordinate(x, y, z);
// -> 0.22167705494211987