https://github.com/davidfig/shape-points
Generate points for simple shapes and curves: arcs, rectangles, rounded rectangles, bezierCurveTo, bezierCurveThrough (i.e., bezier curves through specific points)
https://github.com/davidfig/shape-points
Last synced: 3 months ago
JSON representation
Generate points for simple shapes and curves: arcs, rectangles, rounded rectangles, bezierCurveTo, bezierCurveThrough (i.e., bezier curves through specific points)
- Host: GitHub
- URL: https://github.com/davidfig/shape-points
- Owner: davidfig
- License: mit
- Created: 2017-08-26T12:33:15.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-09-27T01:40:21.000Z (over 1 year ago)
- Last Synced: 2025-09-21T12:28:33.476Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.57 MB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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
```js
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](https://yopeyopey.com/) by [David Figatner](https://twitter.com/yopey_yopey/)