xxxxxxxxxx
var gB, gBRes, cRes;
function setup() {
createCanvas(windowWidth, windowHeight);
imageMode(CENTER);
gB = createGraphics(gBRes = 2048, gBRes);
gB.colorMode(HSB, 360);
background(100);
}
function draw() {
gB.background(360);
gB.stroke(0, 330);
gB.strokeCap(SQUARE);
for (var i = 0; i <= 1; i += 0.0125) {
gB.push();
var lineSize = 64 + 128 * i * random();
var gapSize = 8;
var xPos1 = map(i * i * i * i, 0, 1, 0.75 * gBRes, 0.00 * gBRes);
var xPos2 = map(i * i, 0, 1, 0.75 * gBRes, 1.00 * gBRes);
for (var j = -random(lineSize); j < gBRes; j += lineSize + gapSize) {
xPos1 += random(-1, 1) * random();
xPos2 += random(-1, 1) * random();
gB.strokeWeight(map(i, 0, 1, 1, 4));
gB.line(j, xPos1, j + lineSize, xPos1);
gB.strokeWeight(map(i, 0, 1, 4, 1));
gB.line(j, xPos2, j + lineSize, xPos2);
}
gB.pop();
}
displayBuffer(gB);
noLoop();
}
function displayBuffer(buffer) {
image(buffer, windowWidth/2, windowHeight/2, min(windowWidth, windowHeight), min(windowWidth, windowHeight));
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}