Skip to content

Instantly share code, notes, and snippets.

@pixiebox
Created April 18, 2016 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixiebox/80b9d2e870bd97400d496b3716a8d261 to your computer and use it in GitHub Desktop.
Save pixiebox/80b9d2e870bd97400d496b3716a8d261 to your computer and use it in GitHub Desktop.
Canvas circle border
<!DOCTYPE HTML>
<html>
<head></head>
<body>
<canvas id="canvas" width="500" height="300"></canvas>
<script>
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var centerX = canvas.width / 2;
var centerY = canvas.height / 2;
var radius = 70;
context.beginPath();
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fillStyle = 'blue';
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'orange';
context.stroke();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment