The Matrix in JavaScript in less than 600 bytes
timelessname.com
timelessname.com
There is board I'm developing on with serial port, and kernel debug prints so much garbage it literally fills the entire screen in less than couple of seconds. It was because of faulty/broken hardware and there is busy loop that keeps retrying to access the device.
I could enter shell commands but I/O lines get mixed in between the verbose kernel debug lines. After some time my eyes synced to the screen scroll rate and I could follow the output from bottom to top to read it (repeatedly run command until I could catch the output correctly).
For the moment, I saw "blonde" in fast scrolling random code :) Anyone else had to work like this?
Everytime u-boot barfed on me or I messed up the serial port I ended up having to scan through screenfulls of ASCII junk scrolling by at full speed to get my commands and results out.
The closest I ever got to -real- blonde/brunette effects was when I was debugging the output from a H264 streamer. I could figure out video resolution and slicing properties from the tcpdump trace scrolling by :)
Makes me want to throttle whomever made this with no option to pause output.
- chunks should vertically move down together, they don't just change color
- leading char is a bright green with outer glow
- movement doesn't always start at the top
- there are gaps in the chars
- there are vertical groups as small as 1 char that change chars at random
- there is no trailing transition in the color
(did actually lol)
It might be a decade too late but better late than never.
[1] Wikipedia calls it the "Matrix digital rain", see https://en.wikipedia.org/wiki/Matrix_digital_rain.
- The "random" groups don't look random at all to me. More like there's a series of "standing" characters left behind by the light-green leader, and behind that there's a stream of "running" characters advancing at a different rate. We only see the running characters through gaps in the standing characters, and only in cells that the leader has already visited.
Sadly I never really used canvas before, so I don't know how to hide the dark-green afterglow.
Also: the afterglow is caused by the main loop filling the entire canvas with a black rect with very low opacity. The result is that after so many frames, everything but the actively drawing characters are much darker. Increase the opacity if you want to reduce the length of the effect.
<canvas id=q width=3000 height=3000 style=margin:-10><script>for(m=Math.random,p=[],i=0;i<256;p[i++]=1);setInterval('9Style="rgba(0,0,0,.05)"9Rect(0,0,3000,3000)9Style="#0F0";p.map(function(v,i){9Text(String.fromCharCode(3e4+m()*33),i*10,v);p[i]=v>758+m()*1e4?0:v+10})'.split(9).join(';q.getContext("2d").fill'),33)</script>
edit... and at 319 <canvas id=q style=margin:-10><script>for(q.width=q.height=b=3000,m=Math.random,p=[],i=0;i<256;p[i++]=1);setInterval('9Style="rgba(0,0,0,.05)"9Rect(0,0,b,b)9Style="#0F0";p.map(function(v,i){9Text(String.fromCharCode(3e4+m()*33),i*10,v);p[i]=v>758+m()*1e4?0:v+10})'.split(9).join(';q.getContext("2d").fill'),33)</script> data:text/html,<canvas id=q width=3000 height=3000 style=margin:-10><script>for(m=Math.random,p=[],i=0;i<256;p[i++]=1);setInterval('9Style="rgba(0,0,0,.05)"9Rect(0,0,3000,3000)9Style="#0F0";p.map(function(v,i){9Text(String.fromCharCode(3e4+m()*33),i*10,v);p[i]=v>758+m()*1e4?0:v+10})'.split(9).join(';q.getContext("2d").fill'),33)</script>http://www.reddit.com/r/programming/comments/1ag0c3/someone_...
<script type="text/javascript">
function matrix() {
// initialize variables
for (s = window.screen,
w = q.width = s.width, // on my monitor: 1920
h = q.height = s.height, // on my monitor: 1200
m = Math.random, // random number from 0-1
p = [],
i = 0;
// i ranges from 0 to 255, one element for each character horizontally
// this is enough characters to fill the entire screen horizontally
// canvas won't let you draw off the screen - so I could set this to 1000
i < 256;
// initialize p (the y coordinate of each character) to start at 1
p[i++] = 1);
setInterval(
// every time we call this function we draw the entire screen a very faint black (with a high transparency of 0.05)
// this means every 33 milliseconds the screen is getting slightly darker
// this also acts to darken and fade the green characters - when they are first printed they are dark green, then they slowly fade to black
function() {
// draw black (0,0,0) with alpha (transparency) value 0.05
q.getContext('2d').fillStyle='rgba(0,0,0,0.05)';
// fill the entire screen
q.getContext('2d').fillRect(0,0,w,h);
// #0f0 is a short form for color green (#00FF00)
q.getContext('2d').fillStyle='#0F0';
p.map(
// this function will be called 256 times - once for each element of array p,
function(v,i){
// map over the array p
// v is the value in the array p, which represents the y-coordinate of the text going down
// i is the index of the array p, which represents the x coordinate
// start from unicode char code 30,000 (0x7530) then add a random number from 0-33
// from wikipedia: http://en.wikipedia.org/wiki/List_of_CJK_Unified_Ideographs,_part_2_of_4
// U+753x 田 由 甲 申 甴 电 甶 男 甸 甹 町 画 甼 甽 甾 甿
// U+754x 畀 畁 畂 畃 畄 畅 畆 畇 畈 畉 畊 畋 界 畍 畎 畏
// U+755x 畐
randomNum = m()*33;
// note how the asian characters are slightly different shades
// of green, this depends on their line thickness etc, and doesn't
// really happen for english characters
randomAsianChar = String.fromCharCode(30000 + randomNum);
q.getContext('2d').fillText(
randomAsianChar,
i*10, // x coordinate - each character is 10 x 10
v // y coordinate
);
// draw at least 758 characters down before reseting to the start
minimumHeight=758
num = minimumHeight+m()*10000;
p[i] = (v>num) ? 0 : v+10 // increment the y coordinate by one character (10 pixels), reset when y-coord gets too big
})
},
33) // call every 33 milliseconds
}
</script>
<body style=margin:0 onload="matrix()"><canvas id=q> data:text/html, <canvas id=q style=margin:-10><script>for(q.width=q.height=b=3000,m=Math.random,p=[],i=0;i<256;p[i++]=1);setInterval('9Style="rgba(0,0,0,.05)"9Rect(0,0,b,b)9Style="#0F0";p.map(function(v,i){9Text(String.fromCharCode(3e4+m()*33),i*10,v);p[i]=v>758+m()*1e4?0:v+10})'.split(9).join(';q.getContext("2d").fill'),33)</script>Requires Chrome:
http://htmlpreview.github.com/?http://github.com/briangordon...
I'd love to have one that accurate emulates the real animation.
http://htmlpreview.github.com/?http://rawgithub.com/briangor...
Bash version
sed: 2: "x;s/\n//g;${p;x;} }'s) ": unexpected EOF (pending }'s)
You need GNU Sed for this to work.
I'm nostalgic too (not about Windows that said) but... Windows XP is the most exploited Windows right now: zombie botnets are made of a huge part of Windows XP PCs. Microsoft ain't patching several critical exploits on XP and it has been demonstrated for a fact that any local hole on XP means admin rights.