JSFiddle - React, Tailwind, and code Playground
by KazWolfe
HTML
<canvas class='hacker-3d-shiz'></canvas>
<canvas class='bars-and-stuff'></canvas>
<div class="output-console"></div>
CSS
body {
font-family: consolas;
background:#000;
color: #00FF00;
margin:0;
}
canvas {
position:absolute;
top:0;
left:0;
}
.bars-and-stuff {
left:66.6%;
}
.output-console {
position:fixed;
overflow:hidden;
}
p {
margin:0
}
JavaScript
var canvas = document.querySelector(".hacker-3d-shiz"),
ctx = canvas.getContext("2d"),
canvasBars = document.querySelector(".bars-and-stuff"),
ctxBars = canvasBars.getContext("2d"),
outputConsole = document.querySelector(".output-console");
canvas.width = (window.innerWidth / 3) * 2;
canvas.height = window.innerHeight / 3;
canvasBars.width = window.innerWidth / 3;
canvasBars.height = canvas.height;
outputConsole.style.height = (window.innerHeight / 3) * 2 + 'px';
outputConsole.style.top = window.innerHeight / 3 + 'px';
function getOctet() {
return Math.round(Math.random() * 255);
}
function randIp() {
//generate the ipaddress
var ipaddress_string = getOctet() + '.' + getOctet() + '.' + getOctet() + '.' + getOctet();
return ipaddress_string;
}
function genMAC() {
var hexDigits = "0123456789ABCDEF";
var macAddress = "";
for (var i = 0; i < 6; i++) {
macAddress += hexDigits.charAt(Math.round(Math.random() * 14));
macAddress += hexDigits.charAt(Math.round(Math.random() * 14));
if (i !== 5) macAddress += ":";
}
return macAddress;
}
/* Graphics stuff */
function Square(z) {
this.width = canvas.width / 2;
this.height = canvas.height;
z = z || 0;
this.points = [
new Point({
x: (canvas.width / 2) - this.width,
y: (canvas.height / 2) - this.height,
z: z
}),
new Point({
x: (canvas.width / 2) + this.width,
y: (canvas.height / 2)...