Skip to content

Instantly share code, notes, and snippets.

@superbrothers
Created June 20, 2011 14:13
Show Gist options
  • Save superbrothers/1035670 to your computer and use it in GitHub Desktop.
Save superbrothers/1035670 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>STAR - Canvas</title>
</head>
<body>
<canvas id="star" width="12px" height="11px"></canvas>
</body>
<script><!--
var canvas = document.getElementById('star');
var context = canvas.getContext('2d');
// Style
context.fillStyle = 'rgb(255, 215, 0)';
context.strokeStyle = 'rgb(255, 215, 0)';
context.lineWidth = 1;
// Path
context.beginPath();
context.moveTo(0, 4);
context.lineTo(12, 4);
context.lineTo(2, 11);
context.lineTo(6, 0);
context.lineTo(10, 11);
context.lineTo(0, 4);
context.closePath();
context.fill();
context.stroke();
--></script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment