Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body onload="Gen()">
- <video id="video" autoplay hidden>
- </video>
- <canvas id="canvas" width="500" height="500" style="border:0px solid"/>
- <script>
- var video = document.getElementById("video");
- var c = document.getElementById("canvas");
- var ctx = c.getContext("2d");
- var i=0;
- var canvas = document.getElementById('canvas');
- var context = canvas.getContext('2d');
- var video = document.getElementById('video');
- var mediaConfig = {video:true,audio:true};
- navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
- video.src = this.window.URL.createObjectURL(stream);
- video.play();
- video.addEventListener("play", function() {i = window.setInterval(function() {
- ctx.drawImage(video,0,0,500,500)},1);
- }, false);
- });
- function Gen()
- {
- var text = "";
- var possible = "FABCGDEG01234567";
- for(var i=0; i!=6; i++)
- text+=possible.charAt(Math.floor(Math.random()*possible.length));
- document.body.style.backgroundColor=(text);
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement