BrU32

JS Canvas Rainbow Waterfall Simulation SRC

Sep 8th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <html>
  2. <body onload="setInterval(drawe,312)" background-color="white">
  3. <canvas id="myCanvas" width="1000" height="1000" style="background:black;">
  4. </canvas>
  5. <script>
  6. var ii=555;
  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. ctx.fillRect(0,0,1000,Math.random()*ii,ii);
  22. ctx.fill();
  23. text='';
  24. }
  25. </script>
  26. </body>
Advertisement
Add Comment
Please, Sign In to add comment