0
|
1 |
var ctx = document.getElementById('tutorial').getContext('2d');
|
|
2 |
var lineCap = ['butt','round','square'];
|
|
3 |
|
|
4 |
// Draw guides
|
|
5 |
ctx.save();
|
|
6 |
ctx.strokeStyle = '#09f';
|
|
7 |
ctx.beginPath();
|
|
8 |
ctx.moveTo(10,10);
|
|
9 |
ctx.lineTo(140,10);
|
|
10 |
ctx.moveTo(10,140);
|
|
11 |
ctx.lineTo(140,140);
|
|
12 |
ctx.stroke();
|
|
13 |
|
|
14 |
// Draw lines
|
|
15 |
ctx.strokeStyle = 'black';
|
|
16 |
for (i=0;i<lineCap.length;i++){
|
|
17 |
ctx.lineWidth = 15;
|
|
18 |
ctx.lineCap = lineCap[i];
|
|
19 |
ctx.beginPath();
|
|
20 |
ctx.moveTo(25+i*50,10);
|
|
21 |
ctx.lineTo(25+i*50,140);
|
|
22 |
ctx.stroke();
|
|
23 |
}
|
|
24 |
ctx.restore();
|