Last change
on this file was 2, checked in by Dmitry A. Kuminov, 16 years ago |
Initially imported qt-all-opensource-src-4.5.1 from Trolltech.
|
File size:
528 bytes
|
Line | |
---|
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 | // Filled triangle
|
---|
10 | ctx.beginPath();
|
---|
11 | ctx.moveTo(25,25);
|
---|
12 | ctx.lineTo(105,25);
|
---|
13 | ctx.lineTo(25,105);
|
---|
14 | ctx.fill();
|
---|
15 |
|
---|
16 | // Stroked triangle
|
---|
17 | ctx.beginPath();
|
---|
18 | ctx.moveTo(125,125);
|
---|
19 | ctx.lineTo(125,45);
|
---|
20 | ctx.lineTo(45,125);
|
---|
21 | ctx.closePath();
|
---|
22 | ctx.stroke();
|
---|
23 |
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.