Adds extra handy bits to canvas, including Progress Bars, rounded rectangles, and stadiums.
npm install canvas-extrascanvas-extras adds extra handy bits to canvas, including Progress Bars, rounded rectangles, and stadiums.
javascript
ctx.beginPath();
ctx.progressBar(5, 10, 50, 50, 200, 100, 'orange');
ctx.endPath();
`
This will yield this result:
![Image of progress bar.] (https://rollbot.net/images/progress1.png)
$3
ctx.roundRect(x,y, width, height, roundness)
##### Example
`javascript
ctx.beginPath();
ctx.fillStyle = '#aaaaaa';
ctx.roundRect(50,50, 100, 100, 25);
ctx.fill();
ctx.closePath();
`
This will yield this result:
![Image of rounded square.] (https://rollbot.net/images/square.png)
$3
Stadiums are also known as capsule shapes or pill shapes
ctx.stadium(x,y, width, height)
##### Example
`javascript
ctx.beginPath();
ctx.fillStyle = '#aaaaaa';
ctx.stadium(50,50, 500, 100);
ctx.fill();
ctx.closePath();
``