🚀 draw world
This commit is contained in:
12
packages/draw/pathRoundedRect.ts
Normal file
12
packages/draw/pathRoundedRect.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
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);
|
||||
};
|
||||
Reference in New Issue
Block a user