BrU32

JS Canvas Lasers Random Fill In Area SRC V2

Aug 2nd, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body bgcolor="#000000" onload="var i=setInterval('drawit()',100);">
  4.  
  5. <canvas id="myCanvas" width="1000" height="1000" style="border:10px;color:red;">
  6. Your browser does not support the HTML5 canvas tag.</canvas>
  7.  
  8. <script>
  9. var onetimecolor=prompt("Enter Your Favorite Color:(ie:Red)");
  10. function drawit(){
  11. var c = document.getElementById("myCanvas");
  12. var ctx = c.getContext("2d");
  13. ctx.strokeStyle=(onetimecolor);
  14. ctx.lineThickness= "1000";
  15. for(var i=0;i<20;i++){
  16. ctx.beginPath(Math.random()*1000,Math.random()*1000);
  17. var Line=(Math.random()*1000);
  18. var Line1=(Math.random()*1000);
  19. ctx.moveTo(Line1+Math.floor(Math.random()*500), Line);
  20. ctx.lineTo(Line, Line1-Math.floor(Math.random()*500));
  21. ctx.stroke();
  22. }
  23. }
  24. </script>
  25.  
  26. </body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment