shape-points

3.0.4 • Public • Published

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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.44latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.44
3.0.21
3.0.10
3.0.00
2.0.10
2.0.00
1.7.00
1.6.31
1.6.20
1.6.10
1.6.00
1.5.20
1.5.10
1.5.00
1.4.10
1.4.00
1.3.00
1.2.00
1.1.00
1.0.01

Package Sidebar

Install

npm i shape-points

Weekly Downloads

7

Version

3.0.4

License

MIT

Unpacked Size

4.3 MB

Total Files

82

Last publish

Collaborators

  • davidfig