Advertisement
BrU32

JS Canvas Webcam Custom Fade Out Example SRC V3

Sep 17th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <center>
  2. <body bgcolor="black">
  3. <video id="video" autoplay hidden>
  4. </video>
  5. <canvas id="canvas" width="500" height="500"style="opacity:1.0;fillColor:black;">
  6. <script>
  7. var ii=1;
  8. var inn=prompt("Enter A # Between 0.1 And 0.0001:");
  9. var video = document.getElementById("video");
  10. var c = document.getElementById("canvas");
  11. var ctx = c.getContext("2d");
  12. var i=0;
  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. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  18. video.src = this.window.URL.createObjectURL(stream);
  19. video.play();
  20. video.addEventListener("play", function() {i = window.setInterval(function() {
  21. canvas.style.opacity-=inn;
  22. canvas.style.color='red'
  23. ctx.drawImage(video,ii,23,500,777)},25);
  24. }, false);
  25. });
  26. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement