784573-1.html (768B)
1 <!DOCTYPE html> 2 <!-- 3 Any copyright is dedicated to the Public Domain. 4 http://creativecommons.org/licenses/publicdomain/ 5 6 This tests that paths are stored in device space. This means that changing 7 the transform does not move the points already drawn. 8 --> 9 <html> 10 <head> 11 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 12 </head> 13 <body> 14 <p><canvas width="100" height="100" id="c"></canvas></p> 15 <script type="text/javascript"> 16 var c = document.getElementById('c').getContext('2d'); 17 18 c.shadowColor = '#f00'; 19 c.shadowBlur = 4; 20 c.lineWidth = 2; 21 22 c.translate(50, 40); 23 24 var d = 30; 25 c.beginPath(); 26 c.moveTo(d, 0); 27 for (var n = 0; n < 3; n++) { 28 c.rotate(3.14159 / 2); 29 c.lineTo(d, 0); 30 } 31 c.closePath(); 32 c.stroke(); 33 34 </script> 35 </body> 36 </html>