Advertisement
BrU32

JS Canvas Webcam Looney Tunes FX SRC V1

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