source: trunk/examples/script/context2d/scripts/linecap.js@ 1077

Last change on this file since 1077 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 541 bytes
Line 
1var 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();
Note: See TracBrowser for help on using the repository browser.