radio滚动铁球选择效果

代码语言:html

所属分类:表单美化

代码描述:radio滚动铁球选择效果

代码标签: 选择 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css?family=Oswald&display=swap" rel="stylesheet">

<style>
body {
  display: grid;
  place-items: center;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: -webkit-gradient(linear, left bottom, left top, from(rgba(255, 255, 255, 0.95)), to(rgba(255, 255, 255, 0.95))), -webkit-gradient(linear, left top, left bottom, from(#0070ff), to(#415fff));
  background: linear-gradient(to top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)), linear-gradient(to bottom, #0070ff, #415fff);
}
body:before, body:after {
  content: '';
  position: absolute;
  width: 220px;
  height: 150px;
  left: calc(50% - 2.5px);
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  background: #fff;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), 0 20px 40px 10px rgba(255, 255, 255, 0.85), 0 0 0 0.75px #415fff, 0 10px 40px -20px #0070ff, 0 20px 40px -20px #415fff;
}
body:after {
  box-shadow: none;
  background: -webkit-gradient(linear, left top, left bottom, from(#0070ff), to(#415fff));
  background: linear-gradient(to bottom, #0070ff, #415fff);
  mix-blend-mode: soft-light;
  box-shadow: none;
  z-index: 9;
}
body #wrap {
  position: relative;
  width: 50px;
  height: 150px;
  -webkit-transform-style: preserve-3d;
          transform-style: preserve-3d;
  -webkit-perspective: 400px;
          perspective: 400px;
  -webkit-transform: translateX(-75px);
          transform: translateX(-75px);
}
body #wrap:before, body #wrap:after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: #f2f2f2;
  left: calc(100% + 12.5px);
  -webkit-transform-origin: left;
          transform-origin: left;
  -webkit-transform: rotateY(90deg);
          transform: rotateY(90deg);
}
body #wrap:after {
  left: calc(-100% - 12.5px);
  -webkit-transform-origin: right;
          transform-origin: right;
  -webkit-transform: rotateY(-90deg);
          transform: rotateY(-90deg);
}
body #wrap * {
  -webkit-transform-style: preserve-3d;
          transform-style: preserve-3d;
}
body #wrap *:before, body #wrap *:after {
  -webkit-transform-style: preserve-3d;
          transform-style: preserve-3d;
}
body #wrap label {
  z-index: 9;
  position: absolute;
  left: 75px;
  font-family: 'Oswald';
  text-transform: uppercase;
  width: 200px;
  font-size: 32px;
  height: 50%;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  top: 0;
  color: #fff;
  text-shadow: 0 -1px 2px #fff;
  -webkit-transform: translateY(-2px) translateZ(-15px);
          transform: translateY(-2px) translateZ(-15px);
}
body #wrap label:before {
  content: attr(data-text);
  position: absolute;
  color: rgba(0, 0, 0, 0.25);
  z-index: -1;
  top: 50%;
  -webkit-transform: translateY(calc(-50% + 2px));
          transform: translateY(calc(-50% + 2px));
  left: 0;
  -webkit-filter: blur(2px);
          filter: blur(2px);
}
body #wrap label:nth-of-type(2) {
  top: 50%;
}
body #wrap input {
  position: absolute;
  width: 100%;
  height: 50%;
  left: 0;
  opacity: 0;
  z-index: 999;
  cursor: pointer;
}
body #wrap input:first-of-type {
  top: 0;
}
body #wrap input:first-of-type:checked ~ .sphere {
  -webkit-animation: sphere1 0.75s ease-in-out 1 forwards, sphere3 0.75s ease-in-out 1 forwards;
          animation: sphere1 0.75s ease-in-out 1 forwards, sphere3 0.75s ease-in-out 1 forwards;
}
@-webkit-keyframes sphere1 {
  0% {
    box-shadow: inset 0px 2px 5px -2.5px rgba(0, 0, 0, 0.3), 0 0 5px 0 rgba(0, 0, 0, 0);
  }
  25% {
    box-shadow: inset 0px 3px 5px -2.5px rgba(0, 0, 0, 0.3), 0 0px 5px 0px rgba(0, 0, 0, 0);
  }
  62.5% {
    box-shadow: inset 0px 0px 5px -2.5px rgba(0, 0, 0, 0.3), 0 10px 10px 0px rgba(0, 0, 0, 0.1);
  }
  75% {
    box-shadow: inset -1px -1px 5px -2.5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  }
  100% {
    box-shadow: inset -1px -3px 5px -2.5px rgba(0, 0, 0, 0.3), 0 0 5px 0 rgba(0, 0, 0, 0);
  }
}
@keyframes sphere1 {
  0% {
    box-shadow: inset 0px 2px 5px -2.5px rgba(0, 0, 0, 0.3), 0 0 5px 0 rgba(0, 0, 0, 0);
  }
  25% {
    box-shadow: inset 0px 3px 5px -2.5px rgba(0, 0, 0, 0.3), 0 0px 5px 0px rgba(0, 0, 0, 0);
  }
  62.5% {
    box-shadow: inset 0px 0px 5px -2.5px rgba(0, 0, 0, 0.3), 0 10px 10px 0px rgba(0, 0, 0, 0.1);
  }
  75% {
    box-shadow: inset -1px -1px 5px -2.5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  }
  100% {
    box-shadow: inset -1px -3px 5px -2.5px rgba(0, 0, 0, 0.3), 0 0 5px 0 rgba(0, 0, 0, 0);
  }
}
@-webkit-keyframes sphere3 {
  0% {
    background-position: 50% 5px, center;
  }
  100% {
    background-position: 50% 0px, center;
  }
}
@keyframes sphere3 {
  0% {
    background-position: 50% 5px, center;
  }
  100% {
    background-position: 50% 0px, center;
  }
}
body #wrap input:first-of-type:checked ~ .platform {
  -webkit-animation: check1 0.75s ease-in-out 1 forwards;
          animation: check1 0.75s ease-in-out 1 forwards;
}
body #wrap input:first-of-type:checked ~ .platform:after {
  height: 40px;
  -webkit-transform: translateY(10px) translateZ(40px) rotateX(80deg);
          transform: translateY(10px) translateZ(40px) rotateX(80deg);
  background: -webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, 0.025)), to(#efefef));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.025), #efefef);
  box-shadow: 0 0 5px -3px #efefef;
}
@-webkit-keyframes check1 {
  0% {
    -webkit-transform: rotateX(0deg);
            transform: rotateX(0deg);
    box-shadow: inset 0 -5px 5px -10px rgba(0, 0, 0, 0);
  }
  50% {
    -webkit-transform: rotateX(40deg);
            transform: rotateX(40deg);
    box-shadow: inset 0 80px 35px -10px rgba(0, 0, 0, 0.035);
  }
  100% {
    -webkit-transform: rotateX(0deg);
            transform: rotateX(0deg);
    box-shadow: inset 0 -5px 5px -10px rgba(0, 0, 0, 0);
  }
}
@keyframes check1 {
  0% {
    -webkit-transform: rotateX(0deg);
            transform: rotateX(0deg);
    box-shadow: inset 0 -5px 5px -10px rgba(0, 0, 0, 0);
  }
  50% {
    -webkit-transform: rotateX(40deg);
            transform: rotateX(40deg);
    box-shadow: inset 0 80px 35px -10px rgba(0, 0, 0, 0.035);
  }
  100% {
    -webkit-transform: rotateX(0deg);
            transform: rotateX(0deg);
    box-shadow: inset 0 -5px 5px -10px rgba(0, 0, 0, 0);
  }
}
body #wrap input:first-of-type:checked ~ .platform .hole {
  -webkit-animation: hole1 0.75s ease-in-out 1 forwards;
          animation: hole1 0.75s ease-in-out 1 forwards;
}
@-webkit-keyframes hole1 {
  0% {
    box-shadow: 0 0 0 2px #fff, 0 1px 3px 3px #efefef, inset 0 3px 4px 3px #ddd;
  }
  50% {
    box-shadow: 0 0 0 2px #fff, 0 2px 3px 3px #efefef, inset 0 20px 4px 3px #ddd;
  }
  100% {
    box-shadow: 0 0 0 2px #fff, 0 1px 3px 3px #efefef, inset 0 3px 4px 3px #ddd;
  }
}
@keyframes hole1 {
  0% {
    box-shadow: 0 0 0 2px #fff, 0 1px 3px 3px #efefef, inset 0 3px 4px 3px #ddd;
  }
  50% {
    box-shadow: 0 0 0 2px #fff, 0 2px 3px 3px #efefef, inset 0 20px 4px 3px #ddd;
  }
  100% {
    box-shadow: 0 0 0 2px #fff, 0 1px 3px 3px #efefef, inset 0 3px 4px 3px #ddd;
  }
}
body #wrap input:last-of-type {
  bottom: 0;
}
body #wrap input:last-of-type:ch.........完整代码请登录后点击上方下载按钮下载查看

网友评论0