两个小球拖拽融合试验实例页面

回到相关文章 »

效果:

拖动右侧球

代码:

CSS代码:
.target {
    filter: url("#goo");
}
.ball {
    width: 150px; height: 150px;
    border-radius: 50%;
    background-color: #beceeb;
    position: absolute;
}
HTML代码:
<svg width="0" height="0">
  <defs>
    <filter id="goo">
      <feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
      <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 19 -9" result="goo" />
      <feComposite in="SourceGraphic" in2="goo" operator="atop"/>
    </filter>
  </defs>
</svg>

<div class="target">
    <i id="ball1" class="ball"></i>
    <i id="ball2" class="ball"></i>
</div>