/[suikacvs]/www/test/dom/events/demo/movecanvas.html
Suika

Contents of /www/test/dom/events/demo/movecanvas.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Sat Oct 8 06:13:24 2011 UTC (13 years, 7 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/html
Use mousemove

1 <!DOCTYPE HTML>
2 <title>Canvas</title>
3
4 <style>
5 body {
6 margin: 0;
7 }
8 canvas {
9 background-color: blue;
10 }
11 </style>
12
13 <canvas width=400 height=200></canvas>
14
15 <script>
16 var canvas = document.getElementsByTagName ('canvas')[0];
17 var ctx = canvas.getContext ('2d');
18 ctx.fillStyle = 'white';
19 canvas.addEventListener ('mousemove', function (ev) {
20 ctx.fillRect (ev.clientX - 2, ev.clientY - 2, 4, 4);
21 }, false);
22 </script>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24