BrU32

JS Canvas Random Rainbow Bar Looks Like A WInamp Visual SRC

Sep 7th, 2016
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. <html>
  2. <body onload="setInterval(drawe,22)" background-color="white">
  3. <canvas id="myCanvas" width="1000" height="1000" style="background:black;">
  4. </canvas>
  5. <script>
  6. var ii=4;
  7. function drawe(){
  8. ii++;
  9. var text = "";
  10. var possible = "FABCGDE0123456789";
  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.fillStyle="#"+text;
  17. var c = document.getElementById("myCanvas");
  18. var ctx = c.getContext("2d");
  19. var cts=c.getContext("2d");
  20. ctx.beginPath();
  21.  
  22. ctx.fillRect(10,0,10,Math.random()*ii,ii);
  23. ctx.fillRect(30,0,10,Math.random()*ii,ii);
  24. ctx.fillRect(50,0,10,Math.random()*ii,ii);
  25. ctx.fillRect(70,0,10,Math.random()*ii,ii);
  26. ctx.fillRect(90,0,10,Math.random()*ii,ii);
  27. ctx.fillRect(110,0,10,Math.random()*ii,ii);
  28. ctx.fillRect(130,0,10,Math.random()*ii,ii);
  29. ctx.fillRect(150,0,10,Math.random()*ii,ii);
  30. ctx.fillRect(170,0,10,Math.random()*ii,ii);
  31. ctx.fillRect(190,0,10,Math.random()*ii,ii);
  32. ctx.fillRect(210,0,10,Math.random()*ii,ii);
  33. ctx.fillRect(230,0,10,Math.random()*ii,ii);
  34. ctx.fillRect(250,0,10,Math.random()*ii,ii);
  35. ctx.fillRect(270,0,10,Math.random()*ii,ii);
  36. ctx.fillRect(290,0,10,Math.random()*ii,ii);
  37. ctx.fillRect(310,0,10,Math.random()*ii,ii);
  38. ctx.fillRect(330,0,10,Math.random()*ii,ii);
  39. ctx.fillRect(350,0,10,Math.random()*ii,ii);
  40. ctx.fillRect(370,0,10,Math.random()*ii,ii);
  41. ctx.fillRect(390,0,10,Math.random()*ii,ii);
  42. ctx.fillRect(410,0,10,Math.random()*ii,ii);
  43. ctx.fillRect(430,0,10,Math.random()*ii,ii);
  44. ctx.fillRect(450,0,10,Math.random()*ii,ii);
  45. ctx.fillRect(470,0,10,Math.random()*ii,ii);
  46. ctx.fillRect(490,0,10,Math.random()*ii,ii);
  47. ctx.fillRect(510,0,10,Math.random()*ii,ii);
  48. ctx.fillRect(530,0,10,Math.random()*ii,ii);
  49. ctx.fillRect(550,0,10,Math.random()*ii,ii);
  50. ctx.fillRect(570,0,10,Math.random()*ii,ii);
  51. ctx.fillRect(590,0,10,Math.random()*ii,ii);
  52. ctx.fillRect(610,0,10,Math.random()*ii,ii);
  53. ctx.fillRect(630,0,10,Math.random()*ii,ii);
  54. ctx.fillRect(650,0,10,Math.random()*ii,ii);
  55. ctx.fillRect(670,0,10,Math.random()*ii,ii);
  56. ctx.fillRect(690,0,10,Math.random()*ii,ii);
  57. ctx.fillRect(710,0,10,Math.random()*ii,ii);
  58. ctx.fill();
  59. text='';
  60. }
  61. </script>
  62. </body>
Advertisement
Add Comment
Please, Sign In to add comment