BrU32

JS Webcam Cover WIth Pic/Uncover FX SRC

Feb 1st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1.  
  2. <style>
  3. body{
  4. filter:invert(10%);
  5. }
  6. </style>
  7. <center>
  8. <body onmousemove="setInterval(Load_Img('https://api.audiotool.com/track/dj_bru_-_acid_step/2/cover/128.jpg?showDefault=true'),34)" background-color="white">
  9. <video id="video" autoplay hidden>
  10. </video>
  11. <canvas id="canvas" width="500" height="500" style="drawColor:#FFFFFF">
  12. <script>
  13. var video = document.getElementById("video");
  14. var c = document.getElementById("canvas");
  15. var ctx = c.getContext("2d");
  16. var i=0;
  17. var mediaConfig = { video:true,audio:false};
  18. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  19. video.src = this.window.URL.createObjectURL(stream);
  20. video.play();
  21. video.addEventListener("play", function() {i = window.setInterval(function() {
  22. ctx.drawImage(video,0,0,500,500)},100);
  23. }, false);
  24. });
  25.  
  26. function Load_Img(path){
  27. var h,w;
  28. h=('500');
  29. w=('500')
  30. var canvas = document.getElementById("canvas");
  31. var ctx = canvas.getContext("2d");
  32. var img = new Image();
  33. img.src=(path);
  34. ctx.drawImage(img, 1, 1,h,w);
  35.  
  36. }
  37. </script>
  38.  
  39. </body>
  40. </html>
Add Comment
Please, Sign In to add comment