News for hackers. Stuff that matters.
Re:It's always been you, Canvas2D by leeoniya on Friday March 04, 2022 @02:28PM (#30559255)
i think you'd still need 4 bezierCurveTo commands, so not sure there's any advantage over 4 arcTo:

    function roundedRect(ctx, x, y, width, height, radius) {
      ctx.beginPath();
      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();
    }
https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/...

There are no comments on this comment yet.