3.0.4 • Published 2 years ago

shape-points v3.0.4

Weekly downloads
6
License
MIT
Repository
github
Last release
2 years ago

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

3.0.4

2 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.7.0

6 years ago

1.6.3

6 years ago

1.6.2

7 years ago

1.6.1

7 years ago

1.6.0

7 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago