js+svg实现按钮悬浮炫酷走光光效动画效果代码

代码语言:html

所属分类:悬停

代码描述:js+svg实现按钮悬浮炫酷走光光效动画效果代码

代码标签: js svg 按钮 悬浮 炫酷 走光 光效 动画

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

<html>

<head>
    <style>
        .sketch-button {
          -webkit-tap-highlight-color: transparent;
          cursor: pointer;
          -webkit-appearance: none;
             -moz-appearance: none;
                  appearance: none;
          outline: none;
          border: none;
          font-family: inherit;
          font-size: 16px;
          font-weight: 500;
          background-image: linear-gradient(90deg, #fcecfe, #fbf6e7, #e6fcf5);
          border-radius: 11px;
          padding: 12px 20px;
          position: relative;
          line-height: 24px;
          color: #14387e;
          box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02), 0 4px 16px rgba(0, 0, 0, 0.02), 0 4px 24px rgba(0, 0, 0, 0.02);
        }
        .sketch-button.start svg {
          -webkit-animation: stroke 1s linear;
                  animation: stroke 1s linear;
        }
        .sketch-button .lines {
          position: absolute;
          inset: 0;
          mix-blend-mode: hard-light;
          pointer-events: none;
          z-index: 1;
        }
        .sketch-button .lines > div {
          position: absolute;
          inset: 0;
        }
        .sketch-button .lines > div:last-child {
          transform: rotate(180deg);
        }
        .sketch-button .lines > div svg {
          display: block;
          position: absolute;
          inset: 0;
          overflow: visible;
          fill: none;
          stroke-width: 2;
          stroke: #c9e9ff;
          width: 100%;
          height: 100%;
          stroke-dasharray: 2 10;
          stroke-dashoffset: 14;
          opacity: 0;
        }
        .sketch-button .lines > div svg:nth-child(1) {
          stroke: #f8fcff;
        }
        .sketch-button .lines > div svg:nth-child(2) {
          stroke-width: 6px;
          filter: blur(20px);
        }
        .sketch-button .lines > div svg:nth-child(3) {
          stroke-width: 5px;
          filter: blur(6px);
        }
        .sketch-button .lines > div svg:nth-child(4) {
          stroke-width: 10px;
          filter: blur(56px);
        }
        
        @-webkit-keyframes stroke {
          30%, 55% {
            opacity: 1;
          }
          100% {
            stroke-dashoffset: 4;
            opacity: 0;
          }
        }
        
        @keyframes stroke {
          30%, 55% {
            opacity: 1;
          }
          100% {
            stroke-dashoffset: 4;
            opacity: 0;
          }
        }
        html {
          box-sizing: border-box;
          -webkit-font-smoothing: antialiased;
        }
        
        * {
          box-sizing: inherit;
        }
        *:before, *:after {
          box-sizing: inherit;
        }
        
        body {
          min-height: 100vh;
          display: flex;
          font-family: "Inter", Ari.........完整代码请登录后点击上方下载按钮下载查看

网友评论0