Advertisement
BrU32

JS Canvas Webcam Snow Globe FX Gray Scale SRC!!!!!

Feb 25th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. <style>
  2. body{
  3. filter:grayscale(3822334);
  4.  
  5.  
  6. }
  7.  
  8. </style>
  9. <center>
  10. <body bgcolor="black" onmousemove="drawe();" onmousedown="drawe" onchange="drawe" ondoubkeclick="drawe;">
  11. <video id="video" autoplay hidden>
  12. </video>
  13. <canvas id="canvas" onchange="drawe;" topmost=false onchange="drawe;" width="500" height="500" style="opacity:1.0;fillColor:none;">
  14. <script>
  15. var ii=1;
  16. var video = document.getElementById("video");
  17. var c = document.getElementById("canvas");
  18. var ctx = c.getContext("2d");
  19. var canvas = document.getElementById('canvas');
  20. var context = canvas.getContext('2d');
  21. var video = document.getElementById('video');
  22. var mediaConfig = { video: true,audio:false};
  23. function drawe(){
  24. var possible = "FABCGDE0123456789";
  25. var text = "";
  26. var canvas = document.getElementById("canvas");
  27. var ctx = canvas.getContext("2d");
  28. for(var i=0; i!=6; i++)
  29. text+=possible.charAt(Math.floor(Math.random()*possible.length))
  30. ctx.fillStyle="#FFFFFF";
  31. ctx.beginPath();
  32. ctx.arc(Math.random()*event.x,Math.random()*event.y,2,59,50,Math.PI*180);
  33. ctx.fillRect(Math.random()*event.x,Math.random()*event.y,3,2)
  34. ctx.arc(Math.random()*event.x,Math.random()*event.y,2,59,50,Math.PI*180);
  35. ctx.fillRect(Math.random()*event.x,Math.random()*event.y,3,2)
  36.  
  37. ctx.fill();
  38. text='';
  39. }
  40. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  41. if(ctx.width==500){event.mouseMove++;}
  42. video.src = this.window.URL.createObjectURL(stream);
  43. video.play();
  44. video.addEventListener("play", function() {i = window.setInterval(function() {
  45.  
  46. ctx.topmost=false;
  47. ctx.drawImage(video,Math.random()*-20,0,500,500)},180);
  48. ctx.fill();
  49. drawe;
  50. drawe;
  51. }, false);
  52. });
  53. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement