Skip to content

Instantly share code, notes, and snippets.

@codingedgar
Last active November 16, 2020 23:54
Show Gist options
  • Save codingedgar/f35ca94bb57bebc2e0dd013761cf8548 to your computer and use it in GitHub Desktop.
Save codingedgar/f35ca94bb57bebc2e0dd013761cf8548 to your computer and use it in GitHub Desktop.
Draw a circle with HTML Canvas
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML canvas tag.
</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(95, 50, 40, 0, 2 * Math.PI);
ctx.stroke();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment