equal
deleted
inserted
replaced
|
1 function drawShape() { |
|
2 // get the canvas element using the DOM |
|
3 var canvas = document.getElementById('tutorial'); |
|
4 |
|
5 // Make sure we don't execute when canvas isn't supported |
|
6 if (canvas.getContext){ |
|
7 |
|
8 // use getContext to use the canvas for drawing |
|
9 var ctx = canvas.getContext('2d'); |
|
10 |
|
11 // Draw shapes |
|
12 |
|
13 ctx.beginPath(); |
|
14 ctx.moveTo(75,40); |
|
15 ctx.bezierCurveTo(75,37,70,25,50,25); |
|
16 ctx.bezierCurveTo(20,25,20,62.5,20,62.5); |
|
17 ctx.bezierCurveTo(20,80,40,102,75,120); |
|
18 ctx.bezierCurveTo(110,102,130,80,130,62.5); |
|
19 ctx.bezierCurveTo(130,62.5,130,25,100,25); |
|
20 ctx.bezierCurveTo(85,25,75,37,75,40); |
|
21 ctx.fill(); |
|
22 ctx.globalAlpha = 0.5; |
|
23 } |
|
24 } |
|
25 |
|
26 drawShape(); |