Advertisement
BrU32

JS Canvas Webcam FLIR Custom Stretching V2

Nov 5th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <style>
  2. body{
  3. overflow: visible;
  4. position:center;
  5. width: 100%;
  6. height: 100%;
  7. filter:invert(1.0);
  8. }
  9. .container{
  10. position: center;
  11. width: Math.random()*5vmax+1vmax;
  12. height: Math.random()*15vmax+10vmax;
  13. top: 50%;
  14. left: 50%;
  15. }
  16. </style>
  17. <canvas id="canvas" width='1000' height='1000'></canvas>
  18. <body bgcolor="black" onmousemove="drawe();" onmousedown="drawe" onchange="drawe" ondoubleclick="drawe;">
  19. <button onclick="zoomin();">Stretch Out</button>
  20. <button onclick="zoomout();">Stretch In</button>
  21. <br>
  22. <video id="video" autoplay hidden>
  23. </video>
  24. <canvas id="canvas" width="1000" height="1000"style="opacity:0.0;fillColor:none;">
  25. <script>
  26. var ii=444;
  27. var video = document.getElementById("video");
  28. var c = document.getElementById("canvas");
  29. var ctx = c.getContext("2d");
  30. var canvas = document.getElementById('canvas');
  31. var context = canvas.getContext('2d');
  32. var video = document.getElementById('video');
  33. var mediaConfig = { video: true,audio:false};
  34. function zoomin(){
  35. ii+=5;
  36. }
  37. function zoomout(){
  38. ii-=5;
  39. }
  40. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  41. video.src = this.window.URL.createObjectURL(stream);
  42. video.play();
  43. video.addEventListener("play", function() {i = window.setInterval(function() {
  44. canvas.style.opacity+=1.9;
  45. ctx.drawImage(video,0,500,ii,ii)},1);
  46. ctx.draw();
  47. drawe();
  48. }, false);
  49. });
  50. </script>
  51. </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement