dortmund

randomly generate rectangles on a grid

Usage no npm install needed!

<script type="module">
  import dortmund from 'https://cdn.skypack.dev/dortmund';
</script>

README

dortmund

build status

randomly generate rectangles on a grid

Installation

$ npm install dortmund

API

dortmund(options) ⇒ Array

Randomly generate rectangles on a grid

Kind: global function Returns: Array - Array of rectangles, to be converted to svg with dainty

Param Type Default Description
options Object Configuration options
options.amountOfRectangles number The amount of rectangles to generate
options.maxSvgWidth number The width of the svg canvas
options.maxSvgHeight number The height of the svg canvas
options.rectWidth number The width of the rectangles to generate
options.rectHeight number The height of the rectangles to generate
options.getX number The function that will generate a random x-coordinate, receives all options
options.getY number The function that will generate a random y-coordinate, receives all options
[options.rectAttributes] Object {} Optional attributes to add to the rectangle element

License

MIT