Files
snk/packages/draw/pathRoundedRect.ts
platane a149bab26a 🚀 draw world
2020-07-18 17:46:41 +02:00

13 lines
357 B
TypeScript

export const pathRoundedRect = (
ctx: CanvasRenderingContext2D,
width: number,
height: number,
borderRadius: number
) => {
ctx.moveTo(borderRadius, 0);
ctx.arcTo(width, 0, width, height, borderRadius);
ctx.arcTo(width, height, 0, height, borderRadius);
ctx.arcTo(0, height, 0, 0, borderRadius);
ctx.arcTo(0, 0, width, 0, borderRadius);
};