BrU32

JS Canvas Webcam Random Rainbow Sun Beaming Down FX SRC

Feb 27th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <center>
  2. <body onmousemove="setInterval(drawe,10)" bgcolor="black">
  3. <video id="video" autoplay hidden>
  4. </video>
  5. <canvas id="canvas" width="500" height="500" style="drawColor:#FFFFFF">
  6. <script>
  7. //var inn=prompt("Enter Text:")
  8. var video = document.getElementById("video");
  9. var c = document.getElementById("canvas");
  10. var ctx = c.getContext("2d");
  11. var i=1;
  12. var mediaConfig = { video:true,audio:false};
  13. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  14. video.src = this.window.URL.createObjectURL(stream);
  15. video.play();
  16. video.addEventListener("play", function() {i = window.setInterval(function() {
  17. ctx.drawImage(video,i--,i,i++,i++)},1);
  18. ctx.rotate(180%Math.PI*2)
  19. ctx.topmost=false;
  20. ctx.fill();
  21. }, false);
  22. });
  23.  
  24. var i=500;
  25. function drawe(){
  26. i++;
  27. var text = "";
  28. var possible = "FABCGDE0123456789";
  29. var canvas = document.getElementById("canvas");
  30. var ctx = canvas.getContext("2d");
  31. for(var i=0; i!=6; i++)
  32. text+=possible.charAt(Math.floor(Math.random()*possible.length));
  33. ctx.font="23px Sans Serif";
  34. ctx.fillStyle="#"+text;
  35. var c = document.getElementById("canvas");
  36. var ctx = c.getContext("2d");
  37. ctx.beginPath();
  38. //canvas.style.opacity=Math.random()*1.0;
  39. ctx.font="5000px creepy"
  40. ctx.fillRect(Math.random()*i+90,Math.random()*i,Math.random()*i+900,Math.random()*i++,i++);
  41. ctx.rotate(180%Math.PI*2)
  42. ctx.draw();
  43. text='';
  44. }
  45. </script>
Advertisement
Add Comment
Please, Sign In to add comment