纯css实现夜里的眼睛效果

代码语言:html

所属分类:动画

代码描述:纯css实现夜里的眼睛效果

代码标签: 夜里 眼睛 效果

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


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

<style>
body {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-align: center;
          align-items: center;
  height: 100vh;
  background: #000;
}
body:before {
  content: 'plz hover';
  color: #fff;
  position: absolute;
  width: 100vw;
  bottom: 10px;
  text-align: center;
  font-size: 15px;
  left: 0;
}
body #outer {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-align: center;
          align-items: center;
  -webkit-transform: scale(1.5);
          transform: scale(1.5);
  -webkit-transition: 0.4s ease-in-out;
  transition: 0.4s ease-in-out;
}
body #outer:hover {
  background: #fff;
}
body #outer:hover .wrap.one {
  -webkit-transform: translateX(-185px) translateY(50px);
          transform: translateX(-185px) translateY(50px);
}
body #outer:hover .wrap.two {
  -webkit-transform: translateX(40px) translateY(35px);
          transform: translateX(40px) translateY(35px);
}
body #outer:hover .wrap.two:after {
  box-shadow: 0 0 0 10px #fff;
}
body .filter {
  position: absolute;
}
body .wrap {
  position: absolute;
  -webkit-transition: 0.4s ease-in-out;
  transition: 0.4s ease-in-out;
}
body .wrap.one {
  -webkit-transform: translateX(-65px) translateY(50px);
          transform: translateX(-65px) translateY(50px);
}
body .wrap.one:before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 500px;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 51px blue, inset 0 0 0 54px #fff, inset 0 0 0 90px red;
  top: -165px;
  left: -45px;
  z-index: -1;
}
body .wrap.two {
  -webkit-transform: translateX(-100px) translateY(35px);
          transform: translateX(-100px) translateY(35px);
  mix-blend-mode: darken;
}
body .wrap.two:before, body .wrap.two:after {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 500px;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 50px red, inset 0 0 0 90px blue, inset 0 0 0 93px #fff;
  top: -150px;
  left: -10px;
  z-index: -1;
}
body .wrap.two:after {
  box-shadow: 0 0 0 10px #000;
  -webkit-transition: 0.4s ease-in-out;
  transition: 0.4s ease-in-out;
  z-index: 3;
}
body .wrap.two .inner .cell {
  height: 100px;
  width: 100px;
  -webkit-transform-origin: 40px 100px;
          transform-origin: 40px 100px;
}
body .wrap.two .inner .cell:nth-of-type(1) {
  -webkit-transform: rotate(18deg);
          transform: rotate(18deg);
}
body .wrap.two .inner .cell:nth-of-type(1) svg path {
  -webkit-animation: shift2 1s ease-in-out infinite alternate;
          animation: shift2 1s ease-in-out infinite alternate;
  -webkit-animation-delay: -0.125s;
          animation-delay: -0.125s;
}
@-webkit-keyframes shift2 {
  50% {
    d: path("M 400 0 Q 400 200 580 280 C 770 360 660 400 490 450 C 400 480 10 530 330 650 Q 400 670 400 790 ");
  }
  100% {
    d: path("M 400 0 Q 400 190 160 300 C 20 370 50 450 100 480 C 180 530 240 550 300 570 Q 400 600 400 790 ");
  }
}
@keyframes shift2 {
  50% {
    d: path("M 400 0 Q 400 200 580 280 C 770 360 660 400 490 450 C 400 480 10 530 330 650 Q 400 670 400 790 ");
  }
  100% {
    d: path("M 400 0 Q 400 190 160 300 C 20 370 50 450 100 480 C 180 530 240 550 300 570 Q 400 600 400 790 ");
  }
}
body .wrap.two .inner .cell:nth-of-type(2) {
  -webkit-transform: rotate(36deg);
          transform: rotate(36deg);
}
body .wrap.two .inner .cell:nth-of-type(2) svg path {
  -webkit-animation: shift2 1s ease-in-out infinite alternate;
          animation: shift2 1s ease-in-out infinite alternate;
  -webkit-animation-delay: -0.25s;
          animation-delay: -0.25s;
}
@keyframes shift2 {
  50% {
    d: path("M 400 0 Q 400 200 580 280 C 770 360 660 400 490 450 C 400 480 10 530 330 650 Q 400 670 400 790 ");
  }
  100% {
    d: path("M 400 0 Q 400 190 160 300 C 20 370 50 450 100 480 C 180 530 240 550 300 570 Q 400 600 400 790 ");
  }
}
body .wrap.two .inner .cell:nth-of-type(3) {
  -webkit-transform: rotate(54deg);
          transform: rotate(54deg);
}
body .wrap.two .inner .cell:nth-of-type(3) svg path {
  -webkit-animation: shift2 1s ease-in-out infinite alternate;
          animation: shift2 1s ease-in-out infinite alternate;
  -webkit-animation-delay: -0.375s;
          animation-delay: -0.375s;
}
@keyframes shift2 {
  50% {
    d: path("M 400 0 Q 400 200 580 280 C 770 360 660 400 490 450 C 400 480 10 530 330 650 Q 400 670 400 790 ");
  }
  100% {
    d: path("M 400 0 Q 400 190 160 300 C 20 370 50 450 100 480 C 180 530 240 550 300 570 Q 400 600 400 790 ");
  }
}
body .wrap.two .inner .cell:nth-of-type(4) {
  -webkit-transform: rotate(72deg);
          transform: rotate(72deg);
}
body .wrap.two .inner .cell:nth-of-type(4) svg path {
  -webkit-animation: shift2 1s ease-in-out infinite alternate;
          animation: shift2 1s ease-in-out infinite alternate;
  -webkit-animation-delay: -0.5s;
          animation-delay: -0.5s;
}
@keyframes shift2 {
  50% {
    d: path("M 400 0 Q 400 200 580 280 C 770 360 660 400 490 450 C 400 480 10 530 330 650 Q 400 670 400 790 ");
  }
  100% {
    d: path("M 400 0 Q 400 190 160 300 C 20 370 50 450 100 480 C 180 530 240 550 300 570 Q 400 600 400 790 ");
  }
}
body .wrap.two .inner .cell:nth-of-type(5) {
  -webkit-transform: rotate(90deg);
          transform: rotate(90deg);
}
body .wrap.two .inner .cell:nth-of-type(5) svg path {
  -webkit-animation: shift2 1s ease-in-out infinite alternate;
          animation: shift2 1s ease-in-out infinite alternate;
  -webkit-animation-delay: -0.625s;
          animation-delay: -0.625s;
}
@keyframes shift2 {
  50% {
    d: path("M 400 0 Q 400 200 580 280 C 770 360 660 400 490 450 C 400 480 10 530 330 650 Q 400 670 400 790 ");
  }
  100% {
    d: path("M 400 0 Q 400 190 160 300 C 20 370 50 450 100 480 C 180 530 240 550 300 570 Q 400 600 400 790 ");
  }
}
body .wrap.two .inner .cell:nth-of-type(6) {
  -webkit-transform: rotate(108deg);
          transform: rotate(108deg);
}
body .wrap.two .inner .cell:nth-of-type(6) svg path {
  -webkit-animation: shift2 1s ease-in-out infinite alternate;
          animation: shift2 1s ease-in-out infinite alternate;
  -webkit-animation-delay: -0.75s;
          animation-delay: -0.75s;
}
@keyframes shift2 {
  50% {
    d: path("M 400 0 Q 400 200.........完整代码请登录后点击上方下载按钮下载查看

网友评论0