JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18
  • Score
    100M100P100Q54021F
  • License MIT

Generate points for simple shapes and curves: arcs, rectangles, rounded rectangles, circles, ellipses, bezierCurveTo, bezierCurveThrough (i.e., bezier curves through specific points)

Package Exports

  • shape-points
  • shape-points/dist/shape-points.es.js
  • shape-points/dist/shape-points.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (shape-points) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

shape-points

Generate points for simple shapes and curves: arcs, rectangles, rounded rectangles, circles, ellipses, bezierCurveTo, bezierCurveThrough (i.e., bezier curves through specific points)

rationale

I needed to find the points of a rounded rectangle. Then I had fun adding lots of other shapes and curves.

installation

yarn add shape-points

or

npm i shape-points

programmatic example

import * as ShapePoints from 'shape-points'

// alternatively: 
// const roundedRect = require('shape-points').roundedRect

const points = ShapePoints.roundedRect(125, 100, 200, 100, 30)

// assuming a canvas context was set up
context.moveTo(points[0], points[1])
for (let i = 2; i < points.length; i += 2)
{
    context.lineTo(points[i], points[i + 1])
}
context.stroke()

live example

https://davidfig.github.io/shape-points/

API

https://davidfig.github.io/shape-points/jsdoc/

License

MIT License
(c) 2018 YOPEY YOPEY LLC by David Figatner