2.0.0 • Published 6 years ago

grid-cells v2.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

grid-cells

stable

Computes grid cells coordinates

npm.io

Usage

NPM

grid(width, height, numCellsX, numCellsY, margin)

Returns: List of numCellsX * numCellsY rectangles. [[x, y, w, h], ...]

Example

To get a grid like in the screenshot above

var grid = require('grid-cells');

var cells = grid(1024, 512, 4, 2, 10);
console.log(cells[0]); //-> [ 10, 10, 243, 241 ]

License

MIT, see LICENSE.md for details.

2.0.0

6 years ago

1.1.0

8 years ago

1.0.0

8 years ago