海上船只checkbox动画切换效果

代码语言:html

所属分类:表单美化

代码描述:海上船只checkbox动画切换效果

代码标签: 动画 切换 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
* {
  margin: 0;
  padding: 0;
}
.wrapper {
  position: absolute;
  background: #2b3e51;
  width: 100%;
  height: 100%;
  overflow-y: scroll;
}
.wrapper .switch {
  position: absolute;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 50px;
}
.wrapper .switch input {
  display: none;
}
.wrapper .switch .wave {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 40px;
  width: 120px;
  height: 50px;
  display: none;
}
.wrapper .switch .wave:after {
  content: "";
  width: 60px;
  height: 3px;
  border-radius: 100%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 20%;
  opacity: 0.4;
}
.wrapper .switch .wave:before {
  content: "";
  width: 35px;
  height: 2px;
  border-radius: 100%;
  background: #fff;
  position: absolute;
  top: 10px;
  left: 30%;
  opacity: 0.3;
}
.wrapper .switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e74a42;
  transition: all 1.4s;
  border-radius: 50px;
  z-index: 100;
  overflow: hidden;
}
.wrapper .switch .slider:before,
.wrapper .switch .slider:after {
  position: absolute;
  content: "";
  height: 40px;
  width: 40px;
  left: 5px;
  bottom: 5px;
  border-radius: 30px;
  background-color: #fff;
}
.wrapper .switch .slider:before {
  transition: 0.4s;
}
.wrapper .switch .slider:after {
  transition: 0.5s;
}
.wrapper .switch .slider .fish {
  position: absolute;
  left: -20%;
  top: 20%;
  transition: 1.5s all;
}
.wrapper .switch .slider .fish .body {
  width: 20px;
  height: 20px;
  background: repeating-linear-gradient(-45deg, #e79c2a, #e79c2a 5px, #fb7813 5px, #fb7813 10px);
  border-radius: 0 100% 20% 100%;
  transform: rotate(-45deg);
  position: relative;
}
.wrapper .switch .slider .fish .eye {
  position: absolute;
  top: 8px;
  left: 15px;
  width: 4px;
  height: 4px;
  background-color: #000;
  border-radius: 100%;
}
.wrapper .switch .slider .fish .eye:after {
  content: "";
  width: 1px;
  height: 1px;
  background-color: #fff;
  border-radius: 100%;
  position: absolute;
  top: 25%;
  left: 25%;
}
.wrapper .switch .slider .fish .tail {
  width: 5px;
  height: 5px;
  background: repeating-linear-gradient(-45deg, #e79c2a, #e79c2a 5px, #fb7813 5px, #fb7813 10px);
  border-radius: 100% 10% 0 10%;
  transform: rotate(-45deg);
  position: absolute;
  left: -8px;
  top: 40%;
}
.wrapper .switch .sky {
  position: absolute;
  left: -40%;
  top: -150px;
  width: 100px;
  height: 100px;
  transform: scale(0);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.wrapper .switch .sky .sun .outer {
  background: #e77b21;
  width: 50px;
  height: 50px;
  position: absolute;
  top: -11px;
  border-radius: 5px;
}
.wrapper .switch .sky .sun .outer:before,
.wrapper .switch .sky .sun .outer:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 50px;
  width: 50px;
  background: #e77b21;
  border-radius: 5px;
}
.wrapper .switch .sky .sun .outer:before {
  transform: rotate(30deg);
}
.wrapper .switch .sky .sun .outer:after {
  transform: rotate(60deg);
}
.wrapper .switch .sky .sun .inner {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 100%;
  background-color: #ffd65a;
  top: -12px;
  overflow: hidden;
}
.wrapper .switch .sky .sun .inner:before {
  content: "";
  width: 50px;
  height: 50px;
  border-radius: 100%;
  position: absolute;
  left: 3 px;
  top: 15px;
  background: #ffc631;
}
.wrapper .switch .sky .cloud {
  position: absolute;
  filter: url("#cloud");
  z-index: -1;
}
.wrapper .switch .sky .cloud .rect {
  width: 100px;
  height: 30px;
  background: #fff;
  border-radius: 100px;
}
.wrapper .switch .sky .cloud .circle {
  border-radius: 100%;
  background: #fff;
  position: absolute;
}
.wrapper .switch .sky .cloud .circle-lg {
  width: 50px;
  height: 50px;
  top: -55%;
  left: 5%;
}
.wrapper .switch .sky .cloud .circle-sm {
  width: 50px;
  height: 50px;
  border-radius: 100%;
  left: 35%;
  top: -50%;
}
.wrapper .switch .sky .cloud1 {
  left: -60%;
  top: 20%;
}
.wrapper .switch .sky .cloud2 {
  left: 150px;
  top: 10%;
  opacity: 0.8;
}
.wrapper .switch input:checked + .slider {
  background-color: transparent;
}
.wrapper .switch input:checked + .slider .fish {
  animation: fishMovement 4s linear infinite;
}
.wrapper .switch input:checked ~ .wave {
  background-color: #3398d9;
  display: block;
  filter: url(#wave);
}
.wrapper .switch input:checked + .slider:before {
  transform: translateX(70px);
}
.wrapper .switch input:checked + .slider:after {
  tra.........完整代码请登录后点击上方下载按钮下载查看

网友评论0