BrU32

JS Canvas Rainbow Text Fill Up Space Animation V1

Sep 15th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Page Title</title>
  5. </head>
  6. <body>
  7.  
  8. <h1>This is a Heading</h1>
  9. <p>This is a par<html>
  10. <body onload="setInterval(drawe,22)" background-color="white">
  11. <canvas id="myCanvas" width="1000" height="1000" style="background:black;">
  12. </canvas>
  13. <script>
  14. var inn=prompt('Enter String:');
  15. var outlen=(inn.length*4);
  16. var ii=outlen;
  17.  
  18. function drawe(){
  19. var out
  20. ii++;
  21. var text = "";
  22. var possible = "FABCGDE0123456789";
  23. var canvas = document.getElementById("myCanvas");
  24. var ctx = canvas.getContext("2d");
  25. ctx.font="50px Comis Ariel"
  26. for(var i=0; i!=6; i++)
  27. text+=possible.charAt(Math.floor(Math.random()*possible.length));
  28. ctx.strokeStyle='#'+text;
  29. ctx.fillStyle="#"+text;
  30. var c = document.getElementById("myCanvas");
  31. var ctx = c.getContext("2d");
  32. ctx.beginPath();
  33. ctx.fillText(inn,Math.random()*1000,ii,ii,ii,ii);
  34. //ctx.fill();
  35. text='';
  36. if(outlen<4){
  37.  
  38. }
  39. }
  40. </script>
  41. </body>agraph.</p>
  42.  
  43. </body>
  44. </html>
Advertisement
Add Comment
Please, Sign In to add comment