draw-noise

1.1.0 • Public • Published

draw-noise

Draw the output of a noise function on node-canvas and save it as a PNG!

Noise image

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(/ 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

Package Sidebar

Install

npm i draw-noise

Weekly Downloads

5

Version

1.1.0

License

MIT

Unpacked Size

294 kB

Total Files

9

Last publish

Collaborators

  • scottyfillups