리퀴드 버튼

Liquid button

버튼 주변에 물방울이 맺혔다가 버튼 표면에 스며들듯 합쳐지는 효과. 두 도형이 가까워지면 경계가 매끄럽게 녹아 붙는 "구이(gooey)" 필터로 만듭니다.

다른 이름: Gooey buttonBlob button
···
html
<svg width="0" height="0"><defs><filter id="goo1"><feGaussianBlur in="SourceGraphic" stdDeviation="7" result="b"/><feColorMatrix in="b" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 24 -11"/></filter></defs></svg>
<div class="stage">
  <div class="goo" id="goo">
    <i class="pill"></i>
    <i class="bub b1"></i><i class="bub b2"></i><i class="bub b3"></i>
  </div>
  <span class="label">Hover me</span>
</div>
css
.stage{position:relative;width:100%;height:100%}
.goo{position:absolute;inset:0;filter:url(#goo1)}
.pill{position:absolute;left:50%;bottom:24%;transform:translateX(-50%);width:clamp(96px,32vmin,150px);height:clamp(32px,11vmin,44px);
  border-radius:999px;background:var(--accent)}
.bub{position:absolute;left:50%;bottom:24%;width:16px;height:16px;border-radius:50%;background:var(--accent);animation:rise 2.6s ease-in infinite}
.b2{left:44%;animation-delay:.6s;width:12px;height:12px}
.b3{left:58%;animation-delay:1.2s;width:14px;height:14px}
@keyframes rise{
  0%{transform:translate(-50%,0) scale(.3);opacity:0}
  25%{opacity:1}
  75%{transform:translate(-50%,-64px) scale(1);opacity:1}
  100%{transform:translate(-50%,-84px) scale(0);opacity:0}
}
.label{position:absolute;left:50%;bottom:24%;transform:translateX(-50%);width:clamp(96px,32vmin,150px);height:clamp(32px,11vmin,44px);
  display:grid;place-items:center;color:#fff;font:700 13px/1 sans-serif;pointer-events:none}

두 개의 별도 도형(예: 버튼과 그 위로 떠오르는 원)은 원래 경계가 뚜렷해서, 가까이 붙어도 그냥 겹친 두 도형으로 보입니다. 이걸 하나로 녹여 붙이는 게 SVG 구이 필터입니다 — feGaussianBlur로 두 도형의 가장자리를 흐릿하게 퍼뜨린 다음, feColorMatrix로 알파 채널의 대비를 극단적으로 높입니다(중간 톤의 알파를 0 또는 1로 밀어붙임). 흐려졌던 가장자리 중 두 도형이 겹치는 부분은 알파가 높게 유지되어 그대로 살아남고, 서로 떨어진 부분은 알파가 0으로 깎여 나가면서 마치 물방울이 합쳐진 것처럼 보입니다.

이 필터를 감싸는 컨테이너에 CSS filter: url(#goo)로 걸어두고, 그 안에서 버튼과 작은 원(bubble) 몇 개를 애니메이션으로 아래에서 위로 떠오르게 하면 원이 버튼 가장자리에 닿는 순간 자연스럽게 흡수되는 것처럼 보입니다. 필터가 적용되는 요소들 사이에는 반드시 배경색 차이가 없어야(같은 색이어야) 하나로 녹은 덩어리처럼 보입니다 — 색이 다르면 경계가 남아 어색합니다.

Gaussian blur는 비용이 크지 않지만 필터가 걸린 영역 전체가 매 프레임 다시 그려지므로, 화면 전체가 아니라 버튼 주변의 작은 영역에만 필터를 한정하는 것이 성능에 유리합니다.

언제 쓰나

CTA 버튼 하나 정도의 강조 포인트로 씁니다. 필터가 걸린 영역 전체가 매 프레임 다시 그려지므로 리스트의 버튼 수십 개에 동시에 적용하면 스크롤이 버벅일 수 있습니다.