xxxxxxxxxx
const pebbleHeight = 256;
const pebbleCount = 64;
const pebbleWidth = 32;
function setup() {
createCanvas(1024, 1024, WEBGL);
colorMode(HSB, 360);
noLoop();
}
function draw() { //function calls
background(0);
noStroke();
ambientLight(360);
pointLight(0, 0, 180, windowWidth, -windowHeight * 0.5, 0);
pointLight(0, 0, 180, -windowWidth, -windowHeight * 0.5, 0);
pointLight(random(360), 360, 30, 0, -windowHeight * 2, 0);
rotateX(-0.95);
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));
translate(0, pebbleHeight * pebbleCount * 0.5, -200);
translate(random(-10, 10), -pebbleHeight * random(0.9, 1.1), random(-10, 10));
rotateX(random(-0.1, 0.1))
rotateZ(random(-0.1, 0.1))
rotateY(random(-0.5, 0.5))
specularMaterial(330);
cylinder(random(0.25, 0.125) * pebbleWidth, pebbleHeight * random(0.8, 64), 64);
pop();
}
}
}
function keyTyped() {
if (key === 's') {
saveCanvas();
}
}