0.1.8 • Published 11 months ago

uber-noise v0.1.8

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

uber-noise

advanced noise generation for the browser and node.js

:warning: Work in progress. Expect breaking changes!

Install

Node.js

add uber-noise to your project and import/require it

npm i uber-noise
const UberNoise = require("uber-noise");
// OR
import UberNoise from "uber-noise";

Browser

add script tag to your html and use the global class variable UberNoise

<script src="https://cdn.jsdelivr.net/npm/uber-noise@0.1.7"></script>
const noise = new UberNoise();

const value = noise.get(x, y);

Usage

Basic

Get noise value

const noise = new UberNoise();

// get noise value at x,y
const value = noise.get(x, y);

// get noise value at x,y,z
const value = noise.get(x, y, z);

// get noise value at x,y,z,w
const value = noise.get(x, y, z, w);

Set noise options

// simple fbm noise
const noise = new UberNoise({
  scale: 0.01,
  octaves: 4,
  gain: 0.5,
  lacunarity: 2.0,
});

Set noise options to noise instance

const noise = new UberNoise({
  scale: { min: 0.01, max: 0.1, scale: 0.01 }, // this will set the scale to a noise instance returning values between 0.01 and 0.1
});

Examples

simple 1D noise with p5.js

see it live here

<script src="https://cdn.jsdelivr.net/npm/uber-noise@0.1.7"></script>
// creating noise in setup()
noise = new UberNoise({ scale: 0.005 });
// using noise in draw()
for (let x = 0; x < width; x += stepSize) {
  let v = noise.get(x + counter);
  // ... use v to draw something
}
0.1.8

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago