Last active
July 20, 2024 18:47
-
-
Save harpreetkhalsagtbit/14013b6bf9f475bbc778653fbaa89212 to your computer and use it in GitHub Desktop.
canvas-circle.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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