LiquidGroup measures nearby DOM elements and paints a shared glass surface for the group. Two sufficiently close shapes can appear to form a bridge while their DOM elements still handle individual interactions.
Register two shapes and move one of them
Use a bounded container with two rounded elements. This example assumes the first element is anchored and the second can move to the right from a nearby starting point. Give each element a width, height, and border radius in your layout.
import { LiquidGroup } from 'quick-liquid';
export function mountDroplets(stage: HTMLElement, fixed: HTMLElement, moving: HTMLElement) {
const group = new LiquidGroup(stage, {
mergeDistance: 56,
blendRadius: 22,
resolution: 3,
});
group.add(fixed);
group.add(moving);
return {
move(distance: number) {
moving.style.transform = `translateX(${distance}px)`;
group.updatePositions();
},
destroy() {
group.destroy();
},
};
}
Connect move to an input range to test the transition precisely. mergeDistance gives you the proximity threshold, while blendRadius changes how rounded the joined shapes look. A larger resolution number spaces field samples farther apart. Compare the edge at the sizes and distances that matter in your UI before reducing detail.
Treat the bridge as decoration
Leave the buttons or other controls as separate focus targets while the surface joins. A merge can be visible without changing the application's state or hiding a control's label. For frequent or large moves, keep the group stage compact and profile it as you would any other animated visual area. The droplet merging lab provides a live reference.