xxxxxxxxxx
const pebbleHeight = 16;
const pebbleCount = 12;
const pebbleWidth = 50;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
colorMode(HSB, 360);
noLoop();
}
function draw() { //function calls
background(0);
noStroke();
ambientLight(360);
pointLight(0, 0, 360, 0, 0, width * 0.25);
rotateX(-0.5);
for (var i = 0; i < pebbleCount + 1; i += 1) {
for (var j = 0; j < pebbleCount + 1; j += 1) {
push();
translate(
map(i, 0, pebbleCount, -pebbleCount * 0.5, pebbleCount * 0.5) * pebbleWidth * 2,
0,
map(j, 0, pebbleCount, -pebbleCount * 0.5, pebbleCount * 0.5) * pebbleWidth * 2
);
translate(random(-5, 5), 0, random(-5, 5));
push();
translate(0, pebbleHeight * pebbleCount * 0.5, -200);
for (var k = 0; k < 1 + ~~(pebbleCount * random()); k += 1) {
translate(random(-10, 10), -pebbleHeight * random(0.9, 1.1), random(-10, 10));
push();
rotateX(random(-0.1, 0.1))
rotateZ(random(-0.1, 0.1))
rotateY(random(-0.5, 0.5))
ellipsoid(random(0.75, 0.95) * pebbleWidth, pebbleHeight * random(0.75, 0.95), 32, 32);
pop();
}
pop();
pop();
}
}
}