BrU32

JS Canvas Random Scroll Text SRC

Aug 26th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 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 inn=prompt('Enter Text:');
  7. var ii=40;
  8. function drawe(){
  9. ii++;
  10. var text = "";
  11. var possible = "FABCGDE0123456789";
  12. var canvas = document.getElementById("myCanvas");
  13. var ctx = canvas.getContext("2d");
  14. for(var i=0; i!=6; i++)
  15. text+=possible.charAt(Math.floor(Math.random()*possible.length));
  16. ctx.strokeStyle='#'+text;
  17. ctx.fillStyle="#"+text;
  18. var c = document.getElementById("myCanvas");
  19. var ctx = c.getContext("2d");
  20. ctx.beginPath();
  21. ctx.fillText(''+inn,ii,ii,ii,ii);
  22. ctx.fill();
  23. text='';
  24. }
  25. </script>
  26. </body>
Advertisement
Add Comment
Please, Sign In to add comment