javascript:labirintas
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| javascript:labirintas [2016/12/05 21:13] – aistis | javascript:labirintas [2016/12/06 00:10] (current) – aistis | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| <code html> | <code html> | ||
| - | <canvas id=" | + | <canvas id=" |
| Your browser does not support the HTML5 canvas tag.</ | Your browser does not support the HTML5 canvas tag.</ | ||
| </ | </ | ||
| Line 13: | Line 13: | ||
| var img = new Image; | var img = new Image; | ||
| - | img.src = " | + | img.src = " |
| + | media=javascript: | ||
| ctx.drawImage(img, | ctx.drawImage(img, | ||
| Line 20: | Line 21: | ||
| function refresh(){ | function refresh(){ | ||
| ctx.clearRect(0, | ctx.clearRect(0, | ||
| - | | + | ctx.drawImage(img, |
| - | ctx.beginPath(); | + | ctx.beginPath(); |
| ctx.arc(x, | ctx.arc(x, | ||
| ctx.stroke(); | ctx.stroke(); | ||
| Line 28: | Line 29: | ||
| function checkKey(e) { | function checkKey(e) { | ||
| - | | + | e = e || window.event; |
| - | | + | if (e.keyCode == ' |
| - | else if (e.keyCode == ' | + | else if (e.keyCode == ' |
| - | else if (e.keyCode == ' | + | else if (e.keyCode == ' |
| - | else if (e.keyCode == ' | + | else if (e.keyCode == ' |
| - | | + | if (x < 0) x = 0; |
| - | if (y < 0) y = 0; | + | if (y < 0) y = 0; |
| - | if (x > 600) x = 600; | + | if (x > 600) x = 600; |
| - | if (y > 600) y = 600; | + | if (y > 600) y = 600; |
| refresh(); | refresh(); | ||
| }</ | }</ | ||
javascript/labirintas.1480965183.txt.gz · Last modified: by aistis
