Skip to content

Instantly share code, notes, and snippets.

@xhackjp1
Created March 12, 2019 14:43
Show Gist options
  • Save xhackjp1/eca4c15c40a879796f76265a31f01b60 to your computer and use it in GitHub Desktop.
Save xhackjp1/eca4c15c40a879796f76265a31f01b60 to your computer and use it in GitHub Desktop.
Matrix
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<canvas id="q"></canvas>
</head>
<body>
<script type="text/javascript">
var s = window.screen;
var width = q.width = s.width;
var height = q.height = s.height;
var letters = Array(256).join(1).split('');
var draw = function() {
q.getContext('2d').fillStyle = 'rgba(0,0,0,.05)';
q.getContext('2d').fillRect(0, 0, width, height);
q.getContext('2d').fillStyle = '#0F0';
q.getContext('2d').font = "23px Arial";
letters.map(function(y_pos, index) {
text = Math.random() * 1 > 0.5 ? 0 : 1;
x_pos = index * 17;
q.getContext('2d').fillText(text, x_pos, y_pos);
letters[index] = (y_pos > 758 + Math.random() * 1e4) ? 0 : y_pos + 28;
});
};
setInterval(draw, 33);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment