Random 1's and 0's as a background - randomly changing over time. Could be used as a loader I suppose...
Created
March 30, 2015 23:22
-
-
Save mattfinch/65a53fdb7c3933326b18 to your computer and use it in GitHub Desktop.
Binary Background
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p class="bin"><p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
generateBinary(); | |
setInterval('updateBinary()', 0); | |
}); | |
function generateBinary(){ | |
str = ""; | |
for ( var i = 0; i < 3500; i++ ) { | |
str = str + Math.round(Math.random()); | |
} | |
$(".bin").html(str); | |
} | |
function updateBinary() { | |
str = $(".bin").html(); | |
n = str.length; | |
r = Math.floor(Math.random() * n + 1) | |
$(".bin").html(str.substring(0, r) + Math.round(Math.random()) + str.substring(r + 1)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background: rgba(0,0,0,0.8); | |
margin-top: 5%; | |
} | |
.bin { | |
font-size:1.25em; | |
width: 800px; | |
height: 500px; | |
border-radius: 10px; | |
background: rgb(74,106,138); | |
color: rgba(255,255,255,0.2); | |
margin: 0 auto; | |
font-family: monospace; | |
word-wrap: break-word; | |
line-height: 0.8em; | |
overflow: hidden; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment