https://github.com/joshforisha/noise-deno
Noise algorithms for Deno
https://github.com/joshforisha/noise-deno
deno noise noise-algorithms
Last synced: 2 months ago
JSON representation
Noise algorithms for Deno
- Host: GitHub
- URL: https://github.com/joshforisha/noise-deno
- Owner: joshforisha
- License: unlicense
- Created: 2021-04-29T14:47:14.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-02T00:00:30.000Z (about 5 years ago)
- Last Synced: 2025-10-09T04:19:32.124Z (9 months ago)
- Topics: deno, noise, noise-algorithms
- Language: TypeScript
- Homepage: https://deno.land/x/noise
- Size: 610 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

**Noise** A variety of standardized noise algorithms for Deno.
## Implemented Algorithms
- OpenSimplex noise: 2D, 3D, 4D
- Perlin noise: 2D, 3D, 4D
- Simplex noise: 2D, 3D, 4D
- Value noise: 1D, 2D, 3D, 4D
## Usage
### Fractal Noise
All shaping functions within `fractal/` work with any noise-generating functions in the other modules, in order to stack and octave in a standardized way.
### Function Types
All noise functions output a float between -1 and 1 (`[-1, 1]`).
```typescript
type Noise1D = (x: number) => number;
type Noise2D = (x: number, y: number) => number;
type Noise3D = (x: number, y: number, z: number) => number;
type Noise4D = (x: number, y: number, z: number, w: number) => number;
```
### Interpolations
By default, noise algorithms that rely on interpolating values (namely Perlin and value), default to using linear interpolation `lerp`, but their options allow for setting `mix` to override this. There are other interpolation functions within the `math.ts` module.
```typescript
type Interpolate = (low: number, high: number, t: number) => number;
```
### NoiseOptions
Base options for all noise functions. Contains `depth` (size of permutation table) and `random` (pseudo-random number generator in `[0, 1]`, default: `Math.random`).
```typescript
interface NoiseOptions {
depth?: number;
random?: () => number;
}
```