javascript最近很火呀!下面代码实现了黑客字符下落的场景:
- <body style=margin:0><canvas id=q /><script>var q=document.getElementById('q'),
- s=window.screen,w=q.width=s.width,h=q.height=s.height,p=Array(256).join(1).split(''),
- c=q.getContext("2d"),m=Math;setInterval(function(){c.fillStyle="rgba(0,0,0,0.05)";
- c.fillRect(0,0,w,h);c.fillStyle="rgba(0,255,0,1)";p=p.map(function(v,i){
- c.fillText(String.fromCharCode(m.floor(2720+m.random()*33)),i*10,v);v+=10;
- if(v>768+m.random()*10000)v=0;return v})},33)</script>
来源:timelessname