80's Cyber Grids - p5.js

Click to generate new perspective grid
<div id="p5"></div>
  
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.7/p5.min.js"></script>
<style> body {padding: 0; margin: 0;} </style>
<script language="javascript" type="text/javascript">

var horizon = 0;
x = 0;
var increment = 0;
var incAmount, perspectiveMod, y;
var strokeNum;

function setup() {
  var cnv = createCanvas(800, 600);
  cnv.parent("p5");
  background(0);
  stroke(random(255),random(255),random(255));
  incAmount = random(1,5);
  horizon += random(-100,100);
  y = horizon;
  perspectiveMod = random(2,5);
  
}

function draw() {
  // draw stuff here
    //draw horizontal lines 
    if (x < width){
        line(width/2 + x, horizon, width/2 + x*perspectiveMod, height);
        line(width/2 + -x, horizon, width/2 + -x*perspectiveMod, height);
        x += incAmount*10;
    }
    if (y < height) { 
         line(0, y, width, y);
         y += increment;
         strokeWeight(strokeNum);
         increment += incAmount;
         strokeNum += 1;
    }
    
}


function mousePressed() {
    background(0);
    y=0;
    x=0;
    increment = 0;
    stroke(random(255),random(255),random(255));
    incAmount = random(1,5);
    horizon = width/2 + random(-100,100);
    y = horizon;
    perspectiveMod = random(2,5);
    redraw();
}
</script>