svg+js实现黑色圆圈拖拽回弹效果代码

代码语言:html

所属分类:拖放

代码描述:svg+js实现黑色圆圈拖拽回弹效果代码

代码标签: svg js 黑色 圆圈 拖拽 回弹

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">






    <style>
        body {
          overflow: hidden;
        }
        #wrapper {
          position: absolute;
          inset: 0;
          display: flex;
          align-items: center;
          justify-content: center;
          filter: url("#goo");
        }
        svg {
          display: none;
        }
        #bigBlob {
          position: relative;
          width: 30vmin;
          height: 30vmin;
          border-radius: 50%;
          background: black;
          cursor: pointer;
        }
        #smallBlob {
          position: absolute;
          width: 100%;
          height: 100%;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%) scale(0.5);
          background: black;
          border-radius: 50%;
        }
    </style>


</head>

<body>
    <div id="wrapper" onmousemove="moveFunc(event);" onmouseup="releaseFunc(event);" ontouchmove="moveFunc(event);" ontouchend="releaseFunc(event);">
        <div id="bigBlob" onmousedown="clickFunc(event);" ontouchstart="clickFunc(event);">
            <div id="smallBlob"></div>
        </div>

        <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
    <defs>
      <filter id="goo">
        <feGaussianBlur in="SourceGraphic" stdDeviation="15" 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" />
      &l.........完整代码请登录后点击上方下载按钮下载查看

网友评论0