@chriscourses/perlin-noise
v1.0.6
Published
Library-free Perlin noise derived from p5.js
Downloads
235
Readme
perlin-noise
Simple Perlin noise derived from p5.js
Installation
# Using npm
npm install @chriscourses/perlin-noise
# Using Yarn
yarn add @chriscourses/perlin-noise
Usage
Return a Perlin noise value 0-1:
import { noise } from '@chriscourses/perlin-noise'
const x = noise(10) // returns value 0-1
You can also call noise
in sequence to access all pre-generated noise values:
for (let i = 0; i < 100; i += 0.01;) {
const x = noise(i) // returns value 0-1, but different and related to the previous return value on each loop cycle
}
API
noise(x, y, z)
Returns a Perlin noise generated value 0 - 1
| Parameter | Type | Description | | ------------ | -------- | ----------------------------------- | | x | number | x value for one dimensional noise | | y (optional) | number | y value for two dimensional noise | | z (optional) | number | z value for three dimensional noise |