Advertisement
BrU32

JS Draw Black Rect SRC V1

Oct 28th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body onmousemove="drawe();">
  4. <canvas id="myCanvas" width="500" height="500" style="border:1px">
  5. Your browser does not support the canvas element.
  6. </canvas>
  7. <script>
  8. function drawe(){
  9. var canvas = document.getElementById("myCanvas");
  10. var ctx = canvas.getContext("2d");
  11. ctx.moveTo(event.x,event.y);
  12. ctx.fillRect(event.x+.0001,event.y+.0001,event.x,event.y);
  13. ctx.stroke();
  14. }
  15. </script>
  16. </body>
  17. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement