Advertisement
BrU32

JS Rainbow Canvas Webcam Swiss Cheese FX SRC

Mar 2nd, 2017
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <center>
  2. <body onload="setInterval(drawe,10)" background-color="white">
  3. <video id="video" autoplay hidden>
  4. </video>
  5. <canvas id="canvas" width="500" height="500" style="drawColor:#FFFFFF">
  6. <script>
  7. var video = document.getElementById("video");
  8. var c = document.getElementById("canvas");
  9. var ctx = c.getContext("2d");
  10. var i=0;
  11. var mediaConfig = { video:true,audio:false};
  12. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  13. video.src = this.window.URL.createObjectURL(stream);
  14. video.play();
  15. video.addEventListener("play", function() {i = window.setInterval(function() {
  16. ctx.drawImage(video,0,0,Math.random()*500,Math.random()*500)},0.1);
  17. }, false);
  18. });
  19.  
  20. var ii=250;
  21. function drawe(){
  22. ii++;
  23. var text = "";
  24. var possible = "FABCGDE0123456789";
  25. var canvas = document.getElementById("canvas");
  26. var ctx = canvas.getContext("2d");
  27. for(var i=0; i!=6; i++)
  28. text+=possible.charAt(Math.floor(Math.random()*possible.length));
  29. ctx.strokeStyle='#'+text;
  30. ctx.fillStyle="#"+text;
  31. var c = document.getElementById("canvas");
  32. var ctx = c.getContext("2d");
  33. ctx.beginPath();
  34. ctx.arc(Math.random()*ii,Math.random()*ii,Math.random()*ii,Math.random()*ii,Math.random()*ii*Math.PI++);
  35. ctx.fill();
  36. text='';
  37. }
  38. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement