boids p5.js Generative art

 

On a pitch-black stage, inky trails with drifting hues swell into a flock, knot and unknot like a nebula, and breathe.

The look rests on classic Reynolds Boids (steering behaviors) built from separation, alignment, and cohesion; a spatial hash grid for fast neighborhood queries; a Perlin-noise flow field; alpha compositing that lays a translucent veil to keep afterimages; stroke width modulated by speed; toroidal space with screen-edge wrapping; and HSB color space with time-drifting hue.

Boids is a set of local rules that let global order emerge. Each agent considers only “nearby” peers, yet a whole flock appears. Separation acts as a short-range repulsion to avoid crowding; alignment steers toward the group’s average heading; cohesion pulls toward the local center of mass. Perception radii live in rSep, rAli, rCoh; force weights in wSep, wAli, wCoh. Motion is bounded by maxSpeed and maxForce, preventing overshoot while keeping response crisp—movement that feels almost bodily.

The background drift is a field made by noise, scaled by noiseScale and paced by noiseTime, so each agent is constantly stroked by a faint environmental ripple. The calligraphic line arises by drawing from the previous position to the current one and continually laying a thin curtain via frameAlpha. Faster motion thickens the pen slightly, slower motion thins it, so the flock’s breathing becomes visible. Color uses hue jittered by noise while saturation and brightness stay steady, favoring depth over dazzle.

Seen as an interaction system, the piece says “relations themselves make form.” Each agent measures others and the environment at once, stacking local judgments into vortices, files, merges, and splits—higher-order patterns from simple parts. The parameter space becomes a landscape of expression: the tension of wSep, the discipline of wAli, the centripetal pull of wCoh; the “field of view” set by the r* radii; the “body” defined by maxSpeed and maxForce; the “weather” carried by the noise terms. Mouse-area attraction and repulsion act as brief “events,” stirring the flock; soon after, self-organization reasserts itself.

There is an analogy to music. Each agent is a beat; wAli is ensemble synchrony; wSep sets spacing and breath; wCoh is the gravity of harmony. The r* radii define the listening range; maxForce the instant attack; maxSpeed the tempo ceiling; and noise provides rubato and human sway. If the balance loosens too far, order dissolves into scatter; if it tightens too much, the picture hardens and loses life.

Visual design choices support long viewing. HSB color keeps hue moving smoothly while saturation and brightness remain comfortable, reducing fatigue over time. On a dark ground, faint afterimages accumulate and self-manage contrast; when lines overcrowd, they recede into haze rather than shouting over the scene. The result is density without glare.

There is also an ethic: grow complexity from simple relations instead of leaning on heavy external data. This favors a white-box intelligibility over pure black-box surprise, making the piece suitable for teaching, workshops, and study. You can read the behavior, then hear it in the image.

Finally, the flock is composed as an endless sketch. Time lays down strata; traces reshape the field; new motion inherits what came before. The image remembers. Here, now.


https://setapolo.github.io//PaMa/index.html

Comments

Popular posts from this blog

Japan Jazz Anthology Select: Jazz of the SP Era

In practice, the most workable approach is to measure a composite “civility score” built from multiple indicators.