Advertisement
BrU32

JS Canvas Webcam Custom On/Off Custom Colored Text SRC V1

Sep 26th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 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:white;fillColor:red;">
  6. <script>
  7. var ii=1;
  8. var inn=prompt('Enter Your Name:');
  9. var iii=prompt('Enter Color:')
  10. var video = document.getElementById("video");
  11. var c = document.getElementById("canvas");
  12. var ctx = c.getContext("2d");
  13. var i=0;
  14. var canvas = document.getElementById('canvas');
  15. var context = canvas.getContext('2d');
  16. var video = document.getElementById('video');
  17. var mediaConfig = { video: true,audio:false};
  18. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  19. ctx.strokeStyle=iii;
  20. ctx.fillStyle=iii
  21. ctx.font="50px Comis Ariel"
  22. canvas.style.color=iii;
  23. ctx.strokeText(''+inn,219, 51, 295, 195);
  24. video.src = this.window.URL.createObjectURL(stream);
  25. var stream=video.src;
  26. video.play();
  27. video.addEventListener("play", function() {i = window.setInterval(function() {
  28. ctx.fillText(''+inn,Math.random()*500, Math.random()*500, 295, Math.random()*195);
  29.  
  30. ctx.drawImage(video,ii,ii,500,777)},205);})
  31. this.window.onkeydown=function(){
  32. video.src='';
  33. video.pause;
  34. }
  35. this.window.onkeyup=function(){
  36. video.src=stream;
  37. video.play();
  38. }
  39. });
  40. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement