draw-noise
v1.1.0
Published
Draw the output of a noise function on node-canvas and save it as a PNG!
Downloads
19
Maintainers
Readme
draw-noise
Draw the output of a noise function on node-canvas and save it as a PNG!
Installation
$ yarn add draw-noise
# Or, if you're old-school...
$ npm install --save draw-noise
Usage
const drawNoise = require('draw-noise')
const { Simplex2 } = require('tumult')
const path = require('path')
const simplex = new Simplex2('seed')
const filename = path.join(__dirname, './myimage.png')
drawNoise((x, y) => simplex.gen(x / 32, y / 32), {
width: 400
height: 400
filename
})
API
drawNoise(noiseFn, options)
- noiseFn: A two-dimensional noise function, or an array of two-dimensional noise functions, with a range of [-1, 1] Required
- options:
- width: The width of the image, in pixels. Defaults to
100px
- height: The height of the image, in pixels. Defaults to
100px
- filename: The filename of the image. Can be an absolute or relative path. Defaults to
./noise.png
- width: The width of the image, in pixels. Defaults to