Created
April 18, 2016 10:22
-
-
Save pixiebox/80b9d2e870bd97400d496b3716a8d261 to your computer and use it in GitHub Desktop.
Canvas circle border
This file contains 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
<!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