BrU32

JS Animated Randomized Colors

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