Advertisement
BrU32

JS Canvas Webcam Custom Text Canvas Grayscale SRC V1

Dec 16th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <style>
  2. body{
  3.  
  4. filter:grayscale(100.0%);
  5. }
  6.  
  7. </style>
  8.  
  9. <center>
  10. <body onload="setInterval(drawe,33)" bgcolor="black">
  11. <video id="video" autoplay hidden>
  12. </video>
  13. <canvas id="canvas" width="500" height="500" style="drawColor:#FFFFFF">
  14. <script>
  15. var inn=prompt("Enter Text:")
  16. var video = document.getElementById("video");
  17. var c = document.getElementById("canvas");
  18. var ctx = c.getContext("2d");
  19. var i=0;
  20. var mediaConfig = { video:true,audio:true};
  21. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  22. video.src = this.window.URL.createObjectURL(stream);
  23. video.play();
  24. video.addEventListener("play", function() {i = window.setInterval(function() {
  25. ctx.drawImage(video,1,1)},40);
  26. ctx.topmost=false;
  27. ctx.draw();
  28. }, false);
  29. });
  30.  
  31. var ii=50;
  32. function drawe(){
  33. ii++;
  34. var text = "";
  35. var possible = "FABCGDE0123456789";
  36. var canvas = document.getElementById("canvas");
  37. var ctx = canvas.getContext("2d");
  38. for(var i=0; i!=6; i++)
  39. text+=possible.charAt(Math.floor(Math.random()*possible.length));
  40. ctx.font="35px Sans Serif";
  41. ctx.fillStyle="#"+text;
  42. var c = document.getElementById("canvas");
  43. var ctx = c.getContext("2d");
  44. ctx.beginPath();
  45. ctx.fillText(""+inn,Math.random()*ii+1,Math.random()*ii+1,Math.random()*ii+1,Math.random()*ii+1,ii+1);
  46. //ctx.rotate(18,Math.PI/180)
  47. text='';
  48. }
  49. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement