npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-noise

v0.1.3

Published

A simple module-based javascript library for generating coherent noise. Inspired by the [libnoise](http://libnoise.sourceforge.net/) project for C++.

Downloads

80

Readme

js-noise

A simple module-based javascript library for generating coherent noise. Inspired by the libnoise project for C++.

Installing

npm i js-noise

Compatible with both node and the browser (via browserify).

Modules Overview

Modules are the building blocks for your noise generators. They generate outputs starting with basic types of noise, and can modify or combine different sources of noise to produce unique results. Modules are broken up into 5 major types: Generators (0 inputs, 1 output), Modifiers (1 input, 1 output), Combiners (2 inputs, 1 output), Selectors (n inputs, 1 output), and Transformers (n inputs, 1 output).

Generators

When looking at a module tree, generators are the most basic components. They produce a value based only on the provided coordinates, and have no source modules.

Checkerboard
Produces either -1 or 1 in a checkerboard pattern of cubes. Mostly useful for testing purposes.

Constant
Produces a set value for all inputs.

Echo
Produces one of the input coordinates as output (configurable for x, y, or z). Primarily used in the test suite.

Simplex
Generates simplex noise in the range [-1, 1]. Very useful for creating basic heightmaps, as well as textures.

Voronoi
Generates Voronoi (aka Cell, Worley) noise in the range [0, 1]. Useful for creating such as water and stone.

Modifiers

Modifiers take a single input and alter it.

Abs
Produces the absolute value of its source module.

Clamp
Clamps the value of a source module to within a given range.

Exponent
Raises the value of a source module to a set exponent.

FBM
Performs Fractional Brownian Motion on a source module with configurable octaves.

Invert
Reverses the sign of its source module.

ScaleBias
Applies a scale factor, then adds a constant value (bias).

Transformers

Transformers alter the coordinates being sent to their source modules.

Displace
Uses 3 source modules to alter the coordinates of a 4th source module.

ScalePoint
Scales the coordinates being sent to its source module by a constant amount.

TranslatePoint
Translates the coordinates being sent to its source module by a constant amount.

Misc

Utility modules that don't actually alter the inputs.

Cache
Caches the value of the last used coordinates. Useful if you need to reuse a module in multiple places within your module tree.

// Calculates the value at (0, 0, 0) twice
var simplex = new JSNoise.Module.Simplex();

simplex.getValue(0, 0, 0);
simplex.getValue(0, 0, 0);

// Calculates the value at (0, 0, 0) once
var cache = new JSNoise.Module.Cache();

cache.setSourceModules([simplex]);

cache.getValue(0, 0, 0);
cache.getValue(0, 0, 0);