💾ctx.point()

browsercanvaspathcurves ⟩ ctx.point()

💾 replit:canvas curves

// 🔸 ctx.point()
CanvasRenderingContext2D.prototype.point = function(x, y, {
    color = 'hsl(0 80% 50% / 0.7)',
    radius = 6,
    lineWidth = 2,
} = {}) {

    this.save();

    this.beginPath();
    this.arc(x, y, radius, 0, 2 * Math.PI);

    this.fillStyle = color;
    this.strokeStyle = 'black';
    this.lineWidth = lineWidth;

    this.fill();
    this.stroke();

    this.restore();
};

Last updated