Skip to content

gamedev-js/bin-pack.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bin-pack.js

2d rectangular bin packing in javascript.

Install

npm install bin-pack.js

Usage

  const binpack = require('bin-pack');

  binpack.sort(nodes, 'height', 'descending', true);
  binpack.pack(nodes, algorithmEL.value, 512, 512, 2, true, (i, total, id) => {
    console.log(i, total, id);
  });

Documentation

sort (nodes, sortBy, order, allowRotate)

pack (nodes, algorithm, width, height, padding, allowRotate, progress)

packAutoResize (nodes, algorithm, width, height, padding, allowRotate, progress)

Reference

License

MIT © 2017 Johnny Wu

Releases

No releases published

Packages

No packages published