---
code: "INT-09"
id: "c-bubble"
tab: "dynamic-1"
kind: "interactive"
title: "Animated Bubble · 애니메이션 버블"
library: "ECharts"
deps: ["echarts@5"]
load: "med"
pasteKind: "echarts-mount"
family: "multivariate"
dataShape: "multiple dimensions per record or profile"
tasks: ["explore data", "monitor change", "drill into structure", "compare profiles"]
tags: ["interactive", "live", "exploration", "multivariate", "animated", "bubble", "애니메이션", "버블"]
gallery: "https://graph.heal7.com/#INT-09"
js: "/sku/INT-09.js"
---

# [INT-09] Animated Bubble · 애니메이션 버블

> AI 붙여넣기 카드. 갤러리 런타임(`main.js`)이 아니라 이 파일을 가져와라.

## 언제 가져가나
2초마다 위치·크기 갱신 — 시간에 따라 떠다니는 클러스터.

**응용** Gapminder 스타일 국가 지표, 시장 점유율 변화.

## 데이터 모양
- family: `multivariate`
- dataShape: multiple dimensions per record or profile
- tasks: explore data, monitor change, drill into structure, compare profiles
- tags: interactive, live, exploration, multivariate, animated, bubble, 애니메이션, 버블


## 의존
echarts@5 · load `med` · library `ECharts`

## 붙여넣는 법
1. echarts 5.x 로드 (GL이면 echarts-gl도)
2. 컨테이너 id를 원본 id와 맞추거나 `document.getElementById` 한 줄만 바꾼다
3. `T`, `reg`, `cssv` 가 필요하면 갤러리 테마 스텁을 함께 가져간다

```js
const T = {
  "bg": "transparent",
  "fg": "#ece8f5",
  "sub": "#a59bbd",
  "grid": "rgba(255,255,255,.08)",
  "gold": "#e8c069",
  "royal": "#6b8cff",
  "rose": "#e07a9f",
  "teal": "#6dd2c4",
  "plum": "#b487e8"
};
const cssv = (n, fb) => (getComputedStyle(document.documentElement).getPropertyValue(n).trim() || fb);
const isDark = () => document.documentElement.getAttribute('data-theme') !== 'light';
const charts = [];
const reg = (id, opt) => {
  const dom = document.getElementById(id); if (!dom) return;
  const c = echarts.init(dom, null, {renderer:'canvas'});
  c.setOption(opt);
  charts.push(c);
  return c;
};
const factory = function(){
  const dom = document.getElementById('c-bubble'); if(!dom) return;
  const c = echarts.init(dom);
  const N = 30;
  const colors = [T.gold, T.royal, T.rose, T.teal, T.plum];
  let pts = Array.from({length:N},()=>[Math.random()*100, Math.random()*100, 8+Math.random()*40, Math.floor(Math.random()*5)]);
  function paint(){
    c.setOption({
      backgroundColor:T.bg, tooltip:{}, animationDurationUpdate:1600, animationEasingUpdate:'cubicInOut',
      grid:{top:14,right:14,bottom:24,left:36},
      xAxis:{type:'value', min:0, max:100, axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
      yAxis:{type:'value', min:0, max:100, axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
      series:[{type:'scatter', symbolSize:d=>d[2], data:pts,
        itemStyle:{opacity:.8, color:p=>colors[p.data[3]], shadowBlur:8, shadowColor:'rgba(0,0,0,.4)'},
        emphasis:{itemStyle:{borderColor:'#fff', borderWidth:2}}
      }]
    });
  }
  paint();
  setInterval(()=>{
    pts = pts.map(p=>[
      Math.max(2, Math.min(98, p[0] + (Math.random()*20-10))),
      Math.max(2, Math.min(98, p[1] + (Math.random()*20-10))),
      Math.max(8, Math.min(50, p[2] + (Math.random()*8-4))),
      p[3]
    ]);
    paint();
  }, 2000);
  charts.push(c);
};
factory();
```

## 원본 factory (갤러리 정본 발췌)
- file: `frontend/js/graph-gallery/main.js`
- lines: 1300-1329
- gallery: https://graph.heal7.com/#INT-09
- raw js: https://graph.heal7.com/sku/INT-09.js

```js
function(){
  const dom = document.getElementById('c-bubble'); if(!dom) return;
  const c = echarts.init(dom);
  const N = 30;
  const colors = [T.gold, T.royal, T.rose, T.teal, T.plum];
  let pts = Array.from({length:N},()=>[Math.random()*100, Math.random()*100, 8+Math.random()*40, Math.floor(Math.random()*5)]);
  function paint(){
    c.setOption({
      backgroundColor:T.bg, tooltip:{}, animationDurationUpdate:1600, animationEasingUpdate:'cubicInOut',
      grid:{top:14,right:14,bottom:24,left:36},
      xAxis:{type:'value', min:0, max:100, axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
      yAxis:{type:'value', min:0, max:100, axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
      series:[{type:'scatter', symbolSize:d=>d[2], data:pts,
        itemStyle:{opacity:.8, color:p=>colors[p.data[3]], shadowBlur:8, shadowColor:'rgba(0,0,0,.4)'},
        emphasis:{itemStyle:{borderColor:'#fff', borderWidth:2}}
      }]
    });
  }
  paint();
  setInterval(()=>{
    pts = pts.map(p=>[
      Math.max(2, Math.min(98, p[0] + (Math.random()*20-10))),
      Math.max(2, Math.min(98, p[1] + (Math.random()*20-10))),
      Math.max(8, Math.min(50, p[2] + (Math.random()*8-4))),
      p[3]
    ]);
    paint();
  }, 2000);
  charts.push(c);
}
```

