Skip to content

Instantly share code, notes, and snippets.

@yilliot
Created April 12, 2011 05:29
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 yilliot/914992 to your computer and use it in GitHub Desktop.
Save yilliot/914992 to your computer and use it in GitHub Desktop.
$(function () {
var canvas = $('#draw-square')[0];
if (canvas.getContext) {
var context = canvas.getContext('2d');
var a1 = 1.5*Math.PI; // top 12
var a2 = 0*Math.PI; // right 3
// bottom : 0.5 , left : 1 , top : 1.5 , right : 0(2)
context.arc(200,200,100,a1,a2,false);
context.lineWidth=15;
context.strokeStyle="black"; // line color
context.lineCap = 'round';
context.moveTo(10,150);
context.quadraticCurveTo(150, 100, 200, 100);
context.arcTo(300,100,300,300,100);
context.strokeStyle="black"; // line color
context.stroke();
} else {
alert('ur browser sucks, throw it already :D');
// put code for browsers that don't support canvas here
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment