Advertisement
BrU32

JS Canvas Webcam W\ Random Rainbow Circle Effect SRC

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