Skip to content

Instantly share code, notes, and snippets.

@harpreetkhalsagtbit
Last active July 20, 2024 18:47
Show Gist options
  • Save harpreetkhalsagtbit/14013b6bf9f475bbc778653fbaa89212 to your computer and use it in GitHub Desktop.
Save harpreetkhalsagtbit/14013b6bf9f475bbc778653fbaa89212 to your computer and use it in GitHub Desktop.
canvas-circle.js
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
function drawCircle(x1, y1, x2, y2, color) {
ctx.beginPath()
ctx.arc(100, 100, 50, 0, 2 * Math.PI);
ctx.lineWidth = 2;
ctx.strokeStyle = color;
ctx.stroke();
ctx.closePath()
}
drawCircle(50, 50, 150, 150, "red")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment