xxxxxxxxxx
59
let gridSize = 20;
let spacing = gridSize/1.5;
let inc = 0.00003;
let increasing = true;
function setup() {
createCanvas(600, 600, WEBGL);
rectMode(CENTER);
}
let xOff = 0;
let yOff = 0;
let zOff = 0;
function draw() {
background(0);
strokeWeight(0.5);
// noStroke();
//creating grid
for (
let y = -height / 2 + gridSize;
y < height / 2;
y = y + gridSize + spacing
) {
for (
let x = -width / 2 + gridSize;
x < width / 2;
x = x + gridSize + spacing
) {
let angle = noise(xOff, yOff, zOff) * TWO_PI;
let vector = p5.Vector.fromAngle(angle);
xOff += inc;
push();
fill(map(x % 11, 0,11, 50, 160), map(y%5, 0, 5, 50, 170),
map((x/y)%11, 0, 11, 50 , 170))
translate(x, y);
rotateX(vector.x);
rotateY(vector.y);
rotateZ(angle);
box(gridSize);
pop();
}
yOff += inc;
zOff += 0.000009;
}
}