float b, m, n, s, x, y, z; float size = 40.0; //controls the number of lines (currently one line) int xgridcount = 1; int ygridcount = 1; int zgridcount = 1; float l=.01; int halfx = xgridcount /2 ; int halfy = ygridcount /2; int halfz = zgridcount /2; float a = 0.0; float v; float boxsize = 1; int gDistance; void setup() { size(400,400); noStroke(); //gDistance~the relative closeness //of the comet line relative to the z-axis //dividing width by a smaller number //brings the line closer gDistance = width/2; } float tilt; float electric; float oscillate; void loop() { background(0); //the middle horizontal line push(); if(millis()%3 == 0){ oscillate = (random(-0.1, 0.1)); } tilt = tilt + oscillate; electric = cos(tilt); translate(height/2, height/2); rotateY(electric); fill(255); smooth(); //horizontal middle electric line box(-106, -2, 450); pop(); //the next line goes back and forth push(); m = m + 0.01; n = cos(m)*2; translate(width/2, height/2, -6); scale(n); translate(70, 0, 0); fill(255); scale(n); box(-1, -1, 260); pop(); //the 2nd middle vertical line-moves //with the middle horizontal line push(); if(second()%88 == 0){ oscillate = (random(-0.009, 0.03)); } tilt = tilt + oscillate; electric = cos(tilt); translate(height/4, height/4); rotateY(electric/2); fill(255); smooth(); //horizontal middle electric line box(-3, -3, 800); pop(); //the 3rd middle vertical line-moves //with the middle horizontal line push(); if(second()%88 == 0){ oscillate = (random(-0.009, 0.03)); } tilt = tilt + oscillate; electric = cos(tilt/2); translate(height, height/4); rotateY(electric/3); fill(255); smooth(); //horizontal middle electric line box(-3, -3, 800); pop(); //for the spinning stick x = x + 0.4; if (x > width) { x = -size; } //the spinning stick on the left that looks wide push(); translate(width/2, height/2, -20); tilt = tilt + oscillate; electric = cos(tilt/2); //how it spins rotateX(90+x); rotateY(40+z); x=x+.00001; z=z+.019; fill(255); smooth(); box(-6, 1, 120); pop(); //the crazy spinning stick that flies around the middle translate(width/2, height/2, -40); push(); //how it spins rotateX(100+x); rotateY(40+z); x=x+.00001; z=z+.015; fill(255); smooth(); box(-2, -1, 120); pop(); }