grid-cells

2.0.0 • Public • Published

grid-cells

stable

Computes grid cells coordinates

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.

/grid-cells/

    Package Sidebar

    Install

    npm i grid-cells

    Weekly Downloads

    3

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    2.81 kB

    Total Files

    4

    Last publish

    Collaborators

    • vorg