Advertisement
BrU32

JS Canvas FlIR + Rainbow Balls Shoot Out Effect SRC

Nov 10th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1.  
  2. <style>
  3. body{
  4. overflow: visible;
  5. position:center;
  6. width: 100%;
  7. height: 100%;
  8. filter:invert(1.0);
  9. }
  10. .container{
  11. position: center;
  12. width: Math.random()*5vmax+1vmax;
  13. height: Math.random()*15vmax+10vmax;
  14. top: 50%;
  15. left: 50%;
  16. }
  17. </style>
  18. <center>
  19. <body onload="setInterval(drawe,2)" background-color="white">
  20. <video id="video" autoplay hidden>
  21. </video>
  22. <canvas id="canvas" width="500" height="500" style="drawColor:#FFFFFF">
  23. <script>
  24. var video = document.getElementById("video");
  25. var c = document.getElementById("canvas");
  26. var ctx = c.getContext("2d");
  27. var i=0;
  28. var mediaConfig = { video:true,audio:true};
  29. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  30. video.src = this.window.URL.createObjectURL(stream);
  31. video.play();
  32. video.addEventListener("play", function() {i = window.setInterval(function() {
  33. ctx.drawImage(video,0,0)},20.1);
  34. }, false);
  35. });
  36.  
  37. var ii=500;
  38. function drawe(){
  39. ii--;
  40. var text = "";
  41. var possible = "FABCGDE0123456789";
  42. var canvas = document.getElementById("canvas");
  43. var ctx = canvas.getContext("2d");
  44. for(var i=0; i!=6; i++)
  45. text+=possible.charAt(Math.floor(Math.random()*possible.length));
  46. ctx.strokeStyle='#'+text;
  47. ctx.fillStyle="#"+text;
  48. var c = document.getElementById("canvas");
  49. var ctx = c.getContext("2d");
  50. ctx.beginPath();
  51. ctx.arc(Math.random()*ii,Math.random()*ii,Math.random()*ii,Math.random()/ii,ii);
  52. ctx.fill();
  53. text='';
  54. }
  55. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement