js+css实现万圣节释放小鬼确认按钮动画效果代码

代码语言:html

所属分类:动画

代码描述:js+css实现万圣节释放小鬼确认按钮动画效果代码,点击确认或取消可以看到小鬼的不同表情

代码标签: 万圣节 小鬼 按钮

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">




    <style>
        @font-face {
          font-family: "Stranger";
          src: url("//repo.bfw.wiki/bfwrepo/font/Molot.woff") format("woff");
        }
        body,
        html {
          height: 100%;
          display: grid;
          font-size: 24px;
          --x: 0;
          --y: 0;
          --total: 0;
        }
        
        body {
          background: url(https://assets.codepen.io/t-1/shapelined-Z1xxfm52Htc-unsplash.jpg) no-repeat center center fixed;
          height: 100vh;
          overflow: hidden;
        }
        body:after {
          content: "";
          position: absolute;
          width: 100%;
          height: 100%;
          left: 0;
          top: 0;
          background: inherit;
          z-index: 3;
          filter: saturate(0);
          mix-blend-mode: darken;
        }
        body:before {
          content: "";
          position: absolute;
          width: 100%;
          height: 100%;
          left: 0;
          top: 0;
          pointer-events: none;
          filter: contrast(270%) brightness(2000%) saturate(0);
          z-index: 2;
          background-image: radial-gradient(circle at calc(50% - (var(--x) * -25px)) calc(50% - (var(--y) * -25px)), transparent calc(50px - (var(--total) * -50px)), #000 700px), url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='4.24' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
          background-size: 100% 100%, 200px;
        }
        body.loaded #container:before {
          opacity: 0;
          pointer-events: none;
        }
        
        #container {
          margin: auto;
          font-family: "Stranger";
          display: flex;
          justify-content: center;
          flex-wrap: wrap;
          width: 500px;
          position: relative;
          z-index: 4;
        }
        #container:before {
          content: "";
          position: absolute;
          width: 200vw;
          height: 200vh;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          background: #000;
          z-index: 9;
          transition: opacity 1s ease-in-out;
        }
        #container .buttons {
          margin-top: 1rem;
          width: inherit;
          display: flex;
          justify-content: space-between;
          align-items: center;
          flex-wrap: wrap;
          position: relative;
          z-index: 9;
          perspective: 100px;
        }
        #container .buttons button {
          z-index: 3;
          cursor: pointer;
          width: 45%;
          margin: 0 2.5%;
          font-family: "Stranger";
          font-size: 1.25rem;
          text-transform: uppercase;
          background: transparent;
          border: 0px solid;
          padding: 0.5rem;
          position: relative;
          background: red;
          height: 60px;
          display: flex;
          justify-content: center;
          align-items: center;
          color: #fff;
          letter-spacing: 2px;
          transition: opacity 0.25s ease-in-out;
          background: #fff;
          box-shadow: inset 0 0 20px 20px #fff;
          -webkit-text-stroke: 1.5px #000;
        }
        #container .buttons button > span.word {
          transform: translateY(100px);
        }
        #container .buttons button:hover:not(.active) {
          overflow: visible;
        }
        #container .buttons button.active {
          overflow: visible;
        }
        #container .buttons button.active > span.word {
          transform: translateY(100px);
          transition-delay: 1s;
        }
        #container .buttons button.active > span.word > span {
          opa.........完整代码请登录后点击上方下载按钮下载查看

网友评论0