Advertisement
BrU32

JS Webcam Canvas Snow Globe FX V4 Final Updated W\ Sepia SRC

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