/fibonacci-layout

Fibonacci layout algorithm (tiling, square)

Primary LanguageJavaScript

fibonacci-layout

===

fibonacci layout (斐波那契布局算法)

usage

npm install fibonacci-layout
const fbLayout = require('fibonacci-layout')

const layout = fbLayout(8)

// => 

{ n: 21,
  width: 34,
  height: 21,
  direction: 'left',
  nodes:
   [ [ 0, 0, 1, 1 ],
     [ 0, 1, 1, 1 ],
     [ 0, -2, 2, 2 ],
     [ -3, -2, 3, 3 ],
     [ -3, 1, 5, 5 ],
     [ 2, -2, 8, 8 ],
     [ -3, -15, 13, 13 ],
     [ -24, -15, 21, 21 ] ] }

License

MIT