Advertisement
BrU32

JS Canvas Webcam To Water SRC

Jan 19th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <canvas id="canvas" width='1000' height='1000'></canvas>
  2.  
  3. <body bgcolor="black" onmousemove="drawe();" onmousedown="drawe" onchange="drawe" ondoubleclick="drawe;">
  4. <video id="video" autoplay hidden>
  5. </video>
  6. <canvas id="canvas" width="1000" height="1000"style="opacity:0.0;fillColor:none;">
  7. <script>
  8. var ii=10;
  9.  
  10. var video = document.getElementById("video");
  11. var c = document.getElementById("canvas");
  12. var ctx = c.getContext("2d");
  13. var canvas = document.getElementById('canvas');
  14. var context = canvas.getContext('2d');
  15. var video = document.getElementById('video');
  16. var mediaConfig = { video: true,audio:true};
  17. function drawe(){
  18. }
  19. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  20. video.src = this.window.URL.createObjectURL(stream);
  21. video.play();
  22. ii+=100;
  23. video.addEventListener("play", function() {i = window.setInterval(function() {
  24. canvas.style.opacity+=0.9;
  25. if(i=0){}else{}
  26. ctx.drawImage(video,ii,ii+Math.random()*500,500,i-=10)},1);
  27. ctx.draw();
  28. drawe();
  29. }, false);
  30. });
  31. </script>
  32. </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement