BrU32

JS Canvas Cam Slide In Effect With Strobe Flicker FX SRC

Sep 17th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 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 #:");
  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-=0.1
  22. if(canvas.style.opacity==0.0){
  23. canvas.style.opacity++
  24. }
  25. ctx.drawImage(video,10,10,ii++,ii++)},inn);
  26. ctx.draw();
  27. }, false);
  28. });
  29. </script>
Advertisement
Add Comment
Please, Sign In to add comment