Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body onmousemove="drawe();" onclick="alert('Nice Drawing!!');">
- <canvas id="myCanvas" width="1000" height="1000" style="border:1px;background-color:black">
- Your browser does not support the canvas element.
- </canvas>
- <script>
- function drawe(){
- var possible = "FABCGDE0123456789";
- var text = "";
- var canvas = document.getElementById("myCanvas");
- var ctx = canvas.getContext("2d");
- for(var i=0; i!=6; i++)
- text+=possible.charAt(Math.floor(Math.random()*possible.length))
- ctx.strokeStyle="#"+text;
- ctx.moveTo(event.x+4,event.y-4);
- ctx.lineTo(event.x+4,event.y-1);
- ctx.stroke();
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment