Advertisement
BrU32

JS Canvas Webcam Take Off SRC

Oct 29th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 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:1.0;fillColor:none;">
  7. <script>
  8. var ii=1;
  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:false};
  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++;
  23. video.addEventListener("play", function() {i = window.setInterval(function() {
  24. canvas.style.opacity+=0.9;
  25. ctx.drawImage(video,1,500+ii--)},1);
  26. ctx.draw();
  27. drawe();
  28. }, false);
  29. });
  30. </script>
  31. </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement