p5.js Generative Interactive

The Harmonious Bloom

A digital symphony of petals in resonance with sound

一场花瓣与声响共鸣的数字交响

Creative Coding Lab · Project A
The Harmonious Bloom - pink digital lilies in full bloom on a pale blue canvas

What if a flower could hear? The Harmonious Bloom imagines a fictional species of lily — Lilium Harmonia — that unfurls its petals to gentle rhythm, fading from soft pink at the core to pure white at the edges.

如果花朵能够聆听,会是什么模样?《和谐绽放》虚构了一种百合——Lilium Harmonia—— 它随轻柔的节奏舒展花瓣,从花心的浅粉渐渐晕染至边缘的纯白。

Overview

The Harmonious Bloom is an interactive garden rendered in p5.js: a field of stylized lilies shares the canvas with drifting music-note motifs and softly colored circles tracing slow orbits. As the viewer moves the cursor, the circles stir and gather; clicking a lily coaxes new layers of petals to grow, each one opening gradually rather than snapping into place. When every flower has fully bloomed, the background itself shifts color — a quiet signal that the garden is complete.

The piece grew out of a fascination with how digital elements can mimic organic responses found in nature — the rhythmic opening and closing of flowers in particular — and was inspired in part by the Chinese band Sound Toy. It reflects on harmony, connection, and the unseen relationships between nature and human expression: how subtle shifts in an environment can elicit profound change.

Lilies mid-bloom while music-note motifs drift across the canvas
Music-note motifs drift across the canvas as the lilies begin to unfurl

Technical Elements

Blooming Geometry

A drawFlower() routine constructs each lily from geometric calculations — petals, stem, and leaves — while extra petal layers grow gradually through lerp() interpolation as the viewer interacts.

Orbiting Circles

Each circle remembers its original position and traces a trigonometric orbit around it using cos and sin, or drifts toward the cursor in attract mode, with lerp() blending the two motions smoothly.

Color Resonance

Collision detection between circles and lilies lets a passing circle tint the end colors of nearby petals, creating a dynamic visual interplay where the garden absorbs the palette of its surroundings.

Trailing Nodes

Control nodes follow the mouse with lerp-smoothed motion, leaving fading trails behind. Their own collision routines leave room for further interactive effects in future iterations.

Lilies shifted toward violet and white after absorbing the colors of passing circles
Petals adopt the hues of passing circles, shifting the whole garden toward violet

Process

The first sketch held a single lily reacting to input. It quickly became clear that a lone flower made for a thin conversation — multiple blooms invited the viewer to wander, comparing how each one responded. That expansion brought its own problems: lilies kept crowding into one another, which I solved with a minimum-distance check that randomizes a flower's position until a clear spot is found, capped at one hundred attempts to avoid infinite loops.

The harder balance was between realism and stylization. Petals that snapped open felt mechanical, so a growth-progress factor tied to the number of petal layers lets each bloom open fluidly, while lerp() interpolates angles, colors, and positions throughout — smoothing every transition so nothing disrupts the visual harmony.

Reflections

The most significant discovery was the power of subtle interactivity. Small animations and slight color changes in response to the viewer's presence did far more for immersion than any single dramatic effect — they made the garden feel attentive rather than scripted.

I was also struck by how far simple trigonometric transformations could go: complex, aesthetically pleasing motion emerged from a handful of cos, sin, and lerp() calls, with minimal computational overhead.

Special thanks to Professor Viola He and the learning assistants, whose insights and feedback shaped this project both technically and conceptually.

Future Directions

The lilies currently listen with their eyes — the cursor stands in for melody. The natural next step is real-time audio analysis or other sensor inputs, letting the flowers bloom to actual sound and pushing the piece toward a multi-sensory experience. I would also like to give the garden weather: subtle wind-like swaying driven by sine waves or Perlin noise, multiple blooms sharing a single stem, and richer collision responses such as gentle shape deformations when circles brush against petals.

Built With

  • p5.js
  • Trigonometric Motion
  • lerp() Interpolation
  • Collision Detection