n-gon

create regular polygons with n sides

Usage no npm install needed!

<script type="module">
  import nGon from 'https://cdn.skypack.dev/n-gon';
</script>

README

n-gon

create regular polygons with n sides

stop sign

usage

npm badge

A "polygon" is just an array of [ x, y ] points, which allows you to map it to a new size and position.

const gon = require('n-gon')

let polygon = gon(7)
  .map([ x, y ] => [
    x * size + offset[0],
    y * size + offset[1]
  ])

license

MIT © Brandon Semilla