Skip to content

Instantly share code, notes, and snippets.

@geoffb
Created March 28, 2013 10:46
Show Gist options
  • Save geoffb/5262298 to your computer and use it in GitHub Desktop.
Save geoffb/5262298 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Canvas Path Fill test</title>
</head>
<body>
<canvas id="stage" width="256" height="256"></canvas>
<script>
var stage = document.getElementById("stage");
var ctx = stage.getContext("2d");
ctx.beginPath();
ctx.arc(stage.width / 2, stage.height / 2, 100, 0, Math.PI * 2);
ctx.closePath();
ctx.fillStyle = "cornflowerblue";
ctx.fill(0, 0, stage.width, stage.height);
ctx.lineWidth = 3;
ctx.strokeStyle = "#000";
ctx.stroke();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment