Skip to content

Commit

Permalink
fix: Tweak README and remove draw-noise dep (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipjscott committed Jan 21, 2019
1 parent 3343bf4 commit 9663c99
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 85 deletions.
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/node_modules
node_modules/
build/
.nyc_output/
*.swo
*.swp
TODO.md
*.log
**/build
/.nyc_output
/test/images
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
images/
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
# FastNoiseJS

[![npm version](https://badge.fury.io/js/fastnoisejs.svg)](https://badge.fury.io/js/fastnoisejs)
[![Build Status](https://travis-ci.org/ScottyFillups/FastNoiseJS.svg?branch=master)](https://travis-ci.org/ScottyFillups/FastNoiseJS)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

![Cellular](https://unpkg.com/fastnoisejs@1.0.0/images/GetCellular.png)
![Cubic](https://unpkg.com/fastnoisejs@1.0.0/images/GetCubic.png)
![Perlin](https://unpkg.com/fastnoisejs@1.0.0/images/GetPerlin.png)
![Simplex](https://unpkg.com/fastnoisejs@1.0.0/images/GetSimplex.png)
![Value](https://unpkg.com/fastnoisejs@1.0.0/images/GetValue.png)
![CubicFractal](https://unpkg.com/fastnoisejs@1.0.0/images/GetCubicFractal.png)
![PerlinFractal](https://unpkg.com/fastnoisejs@1.0.0/images/GetPerlinFractal.png)
![SimplexFractal](https://unpkg.com/fastnoisejs@1.0.0/images/GetSimplexFractal.png)
![ValueFractal](https://unpkg.com/fastnoisejs@1.0.0/images/GetValueFractal.png)
![WhiteNoise](https://unpkg.com/fastnoisejs@1.0.0/images/GetWhiteNoise.png)

![Cellular](https://raw.githubusercontent.com/ScottyFillups/FastNoiseJS/master/images/GetCellular)
![Cubic](https://raw.githubusercontent.com/ScottyFillups/FastNoiseJS/master/images/GetCubic.png)
![Perlin](https://raw.githubusercontent.com/ScottyFillups/FastNoiseJS/master/images/GetPerlin.png)
![Simplex](https://raw.githubusercontent.com/ScottyFillups/FastNoiseJS/master/images/GetSimplex.png)
![PerlinFractal]( https://raw.githubusercontent.com/ScottyFillups/FastNoiseJS/master/images/GetPerlinFractal.png)
![SimplexFractal](https://raw.githubusercontent.com/ScottyFillups/FastNoiseJS/master/images/GetSimplexFractal.png)

FastNoiseJS is a noise library that uses [FastNoise](https://github.com/Auburns/FastNoise) as a C++ addon.

## Installation

```bash
$ yarn add fastnoisejs

# Or, if you're old-school:

$ npm install fastnoisejs --save
```

## Usage

```js
const fastnoise = require('fastnoisejs')

const noise = fastnoise.Create(123)

noise.SetNoiseType(fastnoise.Simplex)
Expand All @@ -42,7 +33,7 @@ for (let x = 0; x < 10; x++) {
}
```

## Documentation
## API

For more exhaustive documentation, refer to the [FastNoise wiki](https://github.com/Auburns/FastNoise/wiki). The example below highlights how `fastnoisejs` binds `FastNoise`'s methods and enumerated types:

Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0-development",
"main": "index.js",
"author": "Philip Scott <pscott@zeptohost.com>",
"description": "Fast noise functions for Node.js!",
"description": "FastNoise.cc N-API bindings for Node.js!",
"keywords": [
"fastnoise",
"noise",
Expand All @@ -25,7 +25,7 @@
"gypfile": true,
"scripts": {
"build": "node-gyp configure && node-gyp build",
"test": "nyc mocha --reporter spec --recursive test/**/*.test.js",
"test": "nyc mocha --reporter spec",
"semantic-release": "semantic-release",
"travis-deploy-once": "travis-deploy-once"
},
Expand All @@ -35,12 +35,10 @@
},
"devDependencies": {
"chai": "^4.1.2",
"draw-noise": "^1.1.0",
"mkdirp": "^0.5.1",
"mocha": "^5.0.0",
"node-gyp": "^3.6.2",
"nyc": "^11.4.1",
"segfault-handler": "^1.0.0",
"semantic-release": "^12.4.1",
"travis-deploy-once": "^4.3.4"
},
Expand Down
Binary file removed test/images/GetCellular.png
Binary file not shown.
Binary file removed test/images/GetCubic.png
Binary file not shown.
Binary file removed test/images/GetCubicFractal.png
Binary file not shown.
Binary file removed test/images/GetPerlin.png
Binary file not shown.
Binary file removed test/images/GetPerlinFractal.png
Binary file not shown.
Binary file removed test/images/GetSimplex.png
Binary file not shown.
Binary file removed test/images/GetSimplexFractal.png
Binary file not shown.
Binary file removed test/images/GetValue.png
Binary file not shown.
Binary file removed test/images/GetValueFractal.png
Binary file not shown.
Binary file removed test/images/GetWhiteNoise.png
Binary file not shown.
19 changes: 0 additions & 19 deletions test/lib.test.js → test/test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
const { expect } = require('chai')
const drawNoise = require('draw-noise')
const mkdir = require('mkdirp')
const fastnoise = require('../')
const path = require('path')

const draw = (fn, filename) => {
drawNoise((x, y) => fn(x * 10, y * 10), {
width: 100,
height: 100,
filename: path.join(__dirname, `./images/${filename}`)
})
}

describe('FastNoiseJS library', function () {
let x, y, z
const noise = fastnoise.Create()
Expand Down Expand Up @@ -46,61 +37,51 @@ describe('FastNoiseJS library', function () {
it('should work for GetValue', function () {
expect(noise.GetValue(x, y, z)).to.be.within(-1, 1)
expect(noise.GetValue(x, y)).to.be.within(-1, 1)
draw(noise.GetValue.bind(noise), 'GetValue.png')
})

it('should work for GetValueFractal', function () {
expect(noise.GetValueFractal(x, y, z)).to.be.within(-1, 1)
expect(noise.GetValueFractal(x, y)).to.be.within(-1, 1)
draw(noise.GetValueFractal.bind(noise), 'GetValueFractal.png')
})

it('should work for GetPerlin', function () {
expect(noise.GetPerlin(x, y, z)).to.be.within(-1, 1)
expect(noise.GetPerlin(x, y)).to.be.within(-1, 1)
draw(noise.GetPerlin.bind(noise), 'GetPerlin.png')
})

it('should work for GetPerlinFractal', function () {
expect(noise.GetPerlinFractal(x, y, z)).to.be.within(-1, 1)
expect(noise.GetPerlinFractal(x, y)).to.be.within(-1, 1)
draw(noise.GetPerlinFractal.bind(noise), 'GetPerlinFractal.png')
})

it('should work for GetSimplex', function () {
expect(noise.GetSimplex(x, y, z)).to.be.within(-1, 1)
expect(noise.GetSimplex(x, y)).to.be.within(-1, 1)
draw(noise.GetSimplex.bind(noise), 'GetSimplex.png')
})

it('should work for GetSimplexFractal', function () {
expect(noise.GetSimplexFractal(x, y, z)).to.be.within(-1, 1)
expect(noise.GetSimplexFractal(x, y)).to.be.within(-1, 1)
draw(noise.GetSimplexFractal.bind(noise), 'GetSimplexFractal.png')
})

it('should work for GetCellular', function () {
expect(noise.GetCellular(x, y, z)).to.be.within(-1, 1)
expect(noise.GetCellular(x, y)).to.be.within(-1, 1)
draw(noise.GetCellular.bind(noise), 'GetCellular.png')
})

it('should work for GetCubic', function () {
expect(noise.GetCubic(x, y, z)).to.be.within(-1, 1)
expect(noise.GetCubic(x, y)).to.be.within(-1, 1)
draw(noise.GetCubic.bind(noise), 'GetCubic.png')
})

it('should work for GetCubicFractal', function () {
expect(noise.GetCubicFractal(x, y, z)).to.be.within(-1, 1)
expect(noise.GetCubicFractal(x, y)).to.be.within(-1, 1)
draw(noise.GetCubicFractal.bind(noise), 'GetCubicFractal.png')
})

it('should work for GetWhiteNoise', function () {
expect(noise.GetWhiteNoise(x, y, z)).to.be.within(-1, 1)
expect(noise.GetWhiteNoise(x, y)).to.be.within(-1, 1)
draw(noise.GetWhiteNoise.bind(noise), 'GetWhiteNoise.png')
})
})

Expand Down
40 changes: 1 addition & 39 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ before-after-hook@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-1.1.0.tgz#83165e15a59460d13702cb8febd6a1807896db5a"

bindings@^1.2.1, bindings@^1.3.0:
bindings@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7"

Expand Down Expand Up @@ -829,12 +829,6 @@ caniuse-lite@^1.0.30000792:
version "1.0.30000807"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000807.tgz#51ea478d07269e9dd4d8c639509df61d2516fa92"

canvas@1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/canvas/-/canvas-1.6.0.tgz#7cb6cdd73ebdca7dc6053249626d7e798dfde176"
dependencies:
nan "^2.3.2"

capture-stack-trace@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz#4a6fa07399c26bba47f0b2496b4d0fb408c5550d"
Expand Down Expand Up @@ -1179,10 +1173,6 @@ detect-indent@^4.0.0:
dependencies:
repeating "^2.0.0"

detect-node@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.3.tgz#a2033c09cc8e158d37748fbde7507832bd6ce127"

diff@3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75"
Expand All @@ -1206,13 +1196,6 @@ dot-prop@^4.1.0:
dependencies:
is-obj "^1.0.0"

draw-noise@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/draw-noise/-/draw-noise-1.1.0.tgz#389035e5fa6710090b1db0e2d4e8a2515fa28893"
dependencies:
canvas "1.6.0"
noise-canvas "^1.1.0"

duplexer2@~0.1.0:
version "0.1.4"
resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1"
Expand Down Expand Up @@ -2256,14 +2239,6 @@ ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"

nan@^2.0.9:
version "2.8.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a"

nan@^2.3.2:
version "2.9.2"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.9.2.tgz#f564d75f5f8f36a6d9456cca7a6c4fe488ab7866"

nerf-dart@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/nerf-dart/-/nerf-dart-1.0.0.tgz#e6dab7febf5ad816ea81cf5c629c5a0ebde72c1a"
Expand Down Expand Up @@ -2296,12 +2271,6 @@ node-gyp@^3.6.2:
tar "^2.0.0"
which "1"

noise-canvas@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/noise-canvas/-/noise-canvas-1.1.1.tgz#1e6c16b3a7e167b9e425d5aa9fadf50015e1c7bd"
dependencies:
detect-node "^2.0.3"

"nopt@2 || 3":
version "3.0.6"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
Expand Down Expand Up @@ -2903,13 +2872,6 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0,
version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"

segfault-handler@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/segfault-handler/-/segfault-handler-1.0.0.tgz#9de52bc4cb54169350f0f4295772fc245288f193"
dependencies:
bindings "^1.2.1"
nan "^2.0.9"

semantic-release@^12.4.1:
version "12.4.1"
resolved "https://registry.yarnpkg.com/semantic-release/-/semantic-release-12.4.1.tgz#4faeee44fe7fbebbc7af8cc9e3522eb7877a0260"
Expand Down

0 comments on commit 9663c99

Please sign in to comment.