Created
March 17, 2013 14:05
-
-
Save FabienArcellier/5181641 to your computer and use it in GitHub Desktop.
This snippet generate matrix falling code. I got it by unobfuscate those code. Look at it it's impressive : http://timelessname.com/sandbox/matrix.html
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
<html> | |
<head> | |
<script language="javascript"> | |
function matrix_on_load() | |
{ | |
s=window.screen,w=q.width=s.width,h=q.height=s.height,m=Math.random; | |
// Initialize the number of columns | |
for(p=[],i=0;i<256;p[i++]=0); | |
setInterval('matrix_interval()',33) | |
} | |
function matrix_interval() | |
{ | |
//At each iteration, we overwrite the surface with a mask black with alpha channel to 5% | |
q.getContext('2d').fillStyle='rgba(0,0,0,.05)'; | |
q.getContext('2d').fillRect(0,0,w,h); | |
// The next letter will be draw in flash green | |
q.getContext('2d').fillStyle='#0F0'; | |
// v : value in p | |
// i : index | |
p.map(function(v,i){ | |
q.getContext('2d').fillText(String.fromCharCode(3e4+m()*33),i*10,v); | |
if(v>758+m()*1e4) | |
{ | |
p[i]=0; | |
} | |
else | |
{ | |
p[i]+=10; | |
} | |
}); | |
} | |
</script> | |
</head> | |
<body style=margin:0 onload="matrix_on_load()"><canvas id=q /> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment