perlin-noise-2d
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Perlin Noise 2D

A simple 2D Perlin Noise implementation in JavaScript.

This package depends on the seedrandom package to generate random numbers with a seed.

Installation

Open your command prompt/terminal and type:

npm i --save perlin-noise-2d

How to use

First import the PerlinNoise class.

import PerlinNoise from 'perlin-noise-2d'
// or...
const PerlinNoise = require('perlin-noise-2d')

Then, instantiate your own PerlinNoise object. From there, you can use the .perlin() function to get the noise.

const perlin = new PerlinNoise(8, 12) // Width is 8, Height is 12

perlin.perlin(4.5, 2.5)

You can also specify a seed for your noise. It will always generate the same value given the same seed.

const perlin = new PerlinNoise(8, 8, 9001) // 9001 is the seed

perlin.perlin(2.5, 2.5) // Will always be 0.39800954642327513

Readme

Keywords

none

Package Sidebar

Install

npm i perlin-noise-2d

Weekly Downloads

3

Version

1.0.0

License

ISC

Unpacked Size

5.74 kB

Total Files

7

Last publish

Collaborators

  • malkist