2021年3月23日星期二

Canvas quadraticCurveTo

I spotted this piece of code that generates a rectangle with rounded corners but I would like to be able to increase the size (height and width) of the rectangle as I want.

 var canvas = document.getElementById('newCanvas');   var ctx = canvas.getContext('2d');   ctx.beginPath();   ctx.moveTo(20, 10);   ctx.lineTo(80, 10);   ctx.quadraticCurveTo(90, 10, 90, 20);   ctx.lineTo(90, 80);   ctx.quadraticCurveTo(90, 90, 80, 90);   ctx.lineTo(20, 90);   ctx.quadraticCurveTo(10, 90, 10, 80);   ctx.lineTo(10, 20);   ctx.quadraticCurveTo(10, 10, 20, 10);   ctx.stroke();  
https://stackoverflow.com/questions/66747396/canvas-quadraticcurveto March 22, 2021 at 09:50PM

没有评论:

发表评论