| 1 | var canvas = document.getElementById('tutorial'); |
| 2 | |
| 3 | // Make sure we don't execute when canvas isn't supported |
| 4 | if (canvas.getContext){ |
| 5 | |
| 6 | // use getContext to use the canvas for drawing |
| 7 | var ctx = canvas.getContext('2d'); |
| 8 | |
| 9 | // Draw shapes |
| 10 | ctx.beginPath(); |
| 11 | ctx.arc(75,75,50,0,Math.PI*2,true); // Outer circle |
| 12 | ctx.moveTo(110,75); |
| 13 | ctx.arc(75,75,35,0,Math.PI,false); // Mouth |
| 14 | ctx.moveTo(65,65); |
| 15 | ctx.arc(60,65,5,0,Math.PI*2,true); // Left eye |
| 16 | ctx.moveTo(95,65); |
| 17 | ctx.arc(90,65,5,0,Math.PI*2,true); // Right eye |
| 18 | ctx.stroke(); |
| 19 | |
| 20 | } |