1.0.1 • Published 8 years ago

yy-noise v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

noise.js

a javascript simple noise generator based on code from from scratchapixel.com, via Michael Bromley

Installation

npm install yy-noise

API Reference

creates simple 1D noise this.generator

Kind: global class

new SimpleNoise(options, maxVertices, amplitude, scale)

ParamTypeDefault
optionsobject
maxVerticesnumber256
amplitudenumber1
scalenumber1

Example

const noise = new SimpleNoise({maxVertices: 512, noise: 0.5, scale: 0.25});

     // changes amplitude of noise function
     noise.amplitude = amplitude;

     // sets scale of noise function
     noise.scale = scale;

     // returns the value based on n (usually incremented along an axis)
     for (let x = 0; x < 100; x++)
     {
         noise.get(n);
     }

simpleNoise.get(x) ⇒ number

gets a value

Kind: instance method of SimpleNoise

ParamType
xnumber

simpleNoise.lerp(a, b, t) ⇒ number

Linear interpolation function.

Kind: instance method of SimpleNoise

ParamTypeDescription
anumberThe lower integer value
bnumberThe upper integer value
tnumberThe value between the two

Copyright (c) 2016 YOPEY YOPEY LLC - MIT License - Documented by jsdoc-to-markdown