JSFiddle - React, Tailwind, and code Playground
by Josh Pullen
HTML
<canvas id="canvas">Sorry, you don't have a new enough browser.</canvas>
CSS
body {
margin:0px;
padding:0px;
}
html, body {
width:100%;
height:100%;
}
#canvas {
display:block;
background:black;
}
JavaScript
var canvas = document.getElementById('canvas'),
ctx = canvas.getContext('2d');
function canvasResize() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
canvasResize();
window.onresize = function() {canvasResize()};
function init() {
var lines = [[]]; //2D array
for (x = 0; x < 10; x++) {
//In "lines": 0 ==> X, 1 ==> Y, 2 ==> Direction, 3 ==> Color
switch(round(Math.random() * 5))
lines[x][0] =
};
};
function compute() {
};
function draw() {
};
function loop() {
compute();
draw();
loop();
}
loop();