BrU32

JS Canvas Trippy Color Changing Paint Tool SRC

Sep 12th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body onmousemove="drawe();" onclick="alert('Nice Drawing!!');">
  4. <canvas id="myCanvas" width="1000" height="1000" style="border:1px;background-color:black">
  5. Your browser does not support the canvas element.
  6. </canvas>
  7. <script>
  8. function drawe(){
  9. var possible = "FABCGDE0123456789";
  10. var text = "";
  11. var canvas = document.getElementById("myCanvas");
  12. var ctx = canvas.getContext("2d");
  13. for(var i=0; i!=6; i++)
  14. text+=possible.charAt(Math.floor(Math.random()*possible.length))
  15. ctx.strokeStyle="#"+text;
  16. ctx.moveTo(event.x+4,event.y-4);
  17. ctx.lineTo(event.x+4,event.y-1);
  18. ctx.stroke();
  19. }
  20. </script>
  21. </body>
  22. </html>
Advertisement
Add Comment
Please, Sign In to add comment