var redraw function setup() { createCanvas(4096, 4096, WEBGL); fullscreen() redraw=true } function draw() { if(redraw==true) { background(0); setLights() drawLines(2500) save(); save('myCanvas.jpg'); redraw=false } } function setLights() { ambientLight(100); directionalLight(250, 0, 0, 50, 250, 1) directionalLight(0, 50, 0, 250, -250, 1) } function drawLines(lineCount) { for(i=0; i<lineCount; i++) { var xPos = random(-100,100) var yPos = 0 var zPos = random(-100,100) draw3dLine(xPos, yPos, zPos) } } function draw3dLine(xPos, yPos, zPos) { var xRot = Math.random(0, TWO_PI) var yRot = Math.random(0, TWO_PI) var zRot = Math.random(0, TWO_PI) rotateX(xRot) rotateY(yRot) rotateZ(zRot) translate(xPos, yPos, zPos) noStroke() ambientMaterial(255,100,100) cylinder(2, 1000000, 10, 10, false, false) } |