diff options
Diffstat (limited to 'files/ru')
-rw-r--r-- | files/ru/web/api/canvas_api/tutorial/drawing_shapes/index.html | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/files/ru/web/api/canvas_api/tutorial/drawing_shapes/index.html b/files/ru/web/api/canvas_api/tutorial/drawing_shapes/index.html index 666d80acbf..5f6d218718 100644 --- a/files/ru/web/api/canvas_api/tutorial/drawing_shapes/index.html +++ b/files/ru/web/api/canvas_api/tutorial/drawing_shapes/index.html @@ -492,17 +492,13 @@ original_slug: Web/API/Canvas_API/Tutorial/Рисование_фигур // A utility function to draw a rectangle with rounded corners. -function roundedRect(ctx,x,y,width,height,radius){ +function roundedRect(ctx, x, y, width, height, radius) { ctx.beginPath(); - ctx.moveTo(x,y+radius); - ctx.lineTo(x,y+height-radius); - ctx.quadraticCurveTo(x,y+height,x+radius,y+height); - ctx.lineTo(x+width-radius,y+height); - ctx.quadraticCurveTo(x+width,y+height,x+width,y+height-radius); - ctx.lineTo(x+width,y+radius); - ctx.quadraticCurveTo(x+width,y,x+width-radius,y); - ctx.lineTo(x+radius,y); - ctx.quadraticCurveTo(x,y,x,y+radius); + ctx.moveTo(x, y + radius); + ctx.arcTo(x, y + height, x + radius, y + height, radius); + ctx.arcTo(x + width, y + height, x + width, y + height - radius, radius); + ctx.arcTo(x + width, y, x + width - radius, y, radius); + ctx.arcTo(x, y, x, y + radius, radius); ctx.stroke(); } </pre> |