1.2.3 • Published 5 years ago

noisejs-ilmiont v1.2.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

noisejs

This library contains methods for 2D and 3D Perlin and Simplex noise generation in JavaScript.

The code is based on the original "noisejs" project by "josephg" (https://github.com/josephg/noisejs), which in turn is based on Stefan Gustavson's implementation. This source is fully open and available for any modifications you see fit.

This project contains the following changes over the "josephg" original:

  • Library refactored as an ES6 module
  • Library uses and exports ES6 class syntax
  • Additional code documentation and annotation added.

The module has a single export (default export), an instance of the noise class.

This has the following methods:

  • perlin2(x, y): Generate 2D Perlin noise
  • simplex2(x, y): Generate 2D Simplex noise
  • perlin3(x, y, z): Generate 3D Perlin noise
  • simplex3(x, y, z): Generate 3D Simplex noise
  • seed(value): Seed the noise. Only 65536 different seeds are supported. Use a float between 0 and 1 or an integer from 1 to 65536.

Example usage (from "josephg"):

import noise from "noisejs-ilmiont";

noise.seed(Math.random());

for (var x = 0; x < canvas.width; x++) {
 	for (var y = 0; y < canvas.height; y++) {
		var value_2d = noise.simplex2(x / 100, y / 100);
		var value_3d = noise.simplex3(x / 100, y / 100, time);
	}
}

The library is pretty fast (10 million queries per second) but will be slower than using a shader. If you try and update an entire screen's worth of pixels, it'll be noticeably slow.

This project is open-source software licensed under the terms of the MIT License.

©James Walker 2018.

1.2.3

5 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago