pattern-wall
v1.0.1
Published
Generate positions for pattern in an area
Downloads
3
Readme
Installation
$ npm install --save pattern-wall
Usage
import PatternWall from 'pattern-wall'
const names = ['foo', 'bar', 'baz', 'qux']
const width = 1000
const height = 1000
const pattern = new PatternWall(names, { width, height })
const result = pattern.generate()
console.log(result)
// [ { name: 'foo', position: { x: 775, y: 509 } },
// { name: 'qux', position: { x: 633, y: 213 } },
// { name: 'baz', position: { x: 323, y: 319 } },
// { name: 'bar', position: { x: 515, y: 602 } } ]
Options
Option | Type | Default --- | --- | --- width | number | document.body.clientWidth height | number | document.body.clientHeight size | number | 200 ratio | numer | 0.3
Contribution
- Fork (https://github.com/linyows/pattern-wall/fork)
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Run test suite with the
npm ci
command and confirm that it passes - Create a new Pull Request