console
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame) window.requestAnimationFrame = function(callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function(id) {
clearTimeout(id);
};
}());
var fps, fpsInterval, startTime, now, then, elapsed;
var wh = getWidthHeight();
var X_MAX = wh.width;
var Y_MAX = wh.height;
var letters = Array(614).join(1).split("");
var canvas;
var ctx;
function startAnimating(fps) {
fpsInterval = 1000 / fps;
then = Date.now();
startTime = then;
draw();
}
function clearScreen() {
ctx.fillStyle = "rgba(0, 0, 0, 0.05)";
ctx.fillRect(0, 0, X_MAX, Y_MAX);
}
function drawMatrix(value, index, array) {
var text = String.fromCharCode(61440 + Math.floor(Math.random() * 465));
var y_pos = value;
var x_pos = index * 10;
ctx.fillStyle = "#00ff00";
ctx.fillText(text, x_pos, y_pos);
array[index] = (y_pos > (wh.height - 200) + Math.random() * 200) ? 0 : y_pos + 10;
}
function draw() {
requestAnimationFrame(draw);
now = Date.now();
elapsed = now - then;
if (elapsed > fpsInterval) {
then = now - (elapsed % fpsInterval);
clearScreen();
letters.map(drawMatrix);
}
}
function getWidthHeight() {
var width = 465, height = 465;
if( typeof( window.innerWidth ) == 'number' ) {
width = window.innerWidth;
height = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
width = document.documentElement.clientWidth;
height = document.documentElement.clientHeight;
}
return {
width: width,
height: height
}
}
function init() {
canvas = document.getElementById("Canvas");
canvas.setAttribute("width", X_MAX);
canvas.setAttribute("height", Y_MAX);
ctx = canvas.getContext("2d");
ctx.font = "10px 'FontAwesome'";
startAnimating(24);
}
init();
<canvas id="Canvas"></canvas>
* {
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
}
body {
background: #000;
font: 30px sans-serif;
width: 100%;
height: 100%;
}