Advertisement
BrU32

JS Canvas Cam Draw Custom Red Blood Text W Start/Stop SRC

Sep 26th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 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 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. ctx.strokeStyle='red';
  19. ctx.fillStyle='red';
  20. //ctx.strokeText(''+inn,219, 51, 295, 195);
  21. video.src = this.window.URL.createObjectURL(stream);
  22. var stream=video.src;
  23. video.play();
  24. video.addEventListener("play", function() {i = window.setInterval(function() {
  25. ctx.fillText(''+inn,Math.random()*500, Math.random()*500, 295, Math.random()*195);
  26. //canvas.style.opacity=0.4;
  27. canvas.style.color='red'
  28. ctx.drawImage(video,ii,ii,500,777)},205);})
  29. this.window.onkeydown=function(){
  30. video.src='';
  31. video.pause;
  32. }
  33. this.window.onkeyup=function(){
  34. video.src=stream;
  35. video.play();
  36. }
  37. });
  38. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement