GiC (Gestalten in Code) Lang

Back to examples

Nested-loop Bubbles

Nested-loop Bubbles thumbnail

Based on Fabian's nested-loop bubbles sketch, nested repeats place 225 circles on a regular grid. Their radii scale from the original 25–70 pixel diameters to GIC radii of 3.125–8.75; translucent OKLCH hues range from 30 to 230. Black outlines are retained at quarter width to match the scaled source. The original 400-pixel square grid is scaled to fit the 100-pixel GIC canvas.

// ABOUTME: Draws a grid of translucent, randomly sized bubbles.
// ABOUTME: Adapts Fabian's nested-loop bubble sketch to GIC dimensions.
// Source: https://snippets.qawsed.site/p5js/loop/nested-loops-bubbles/index.js
randomSeed(225);
background("black");
strokeWidth(0.25);
repeat(column, 1, 16) {
	repeat(row, 1, 16) {
		let x = column * 6.25;
		let y = row * 6.25;
		fill(65, 12, random(30, 230), random(0, 30));
		circle(x, y, random(3.125, 8.75));
	}
}