纯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 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(7) { -webkit-transform: rotate(126deg); transform: rotate(126deg); } body .wrap.two .inner .cell:nth-of-type(7) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -0.875s; animation-delay: -0.875s; } @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(8) { -webkit-transform: rotate(144deg); transform: rotate(144deg); } body .wrap.two .inner .cell:nth-of-type(8) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -1s; animation-delay: -1s; } @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(9) { -webkit-transform: rotate(162deg); transform: rotate(162deg); } body .wrap.two .inner .cell:nth-of-type(9) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -1.125s; animation-delay: -1.125s; } @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(10) { -webkit-transform: rotate(180deg); transform: rotate(180deg); } body .wrap.two .inner .cell:nth-of-type(10) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -1.25s; animation-delay: -1.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(11) { -webkit-transform: rotate(198deg); transform: rotate(198deg); } body .wrap.two .inner .cell:nth-of-type(11) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -1.375s; animation-delay: -1.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(12) { -webkit-transform: rotate(216deg); transform: rotate(216deg); } body .wrap.two .inner .cell:nth-of-type(12) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -1.5s; animation-delay: -1.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(13) { -webkit-transform: rotate(234deg); transform: rotate(234deg); } body .wrap.two .inner .cell:nth-of-type(13) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -1.625s; animation-delay: -1.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(14) { -webkit-transform: rotate(252deg); transform: rotate(252deg); } body .wrap.two .inner .cell:nth-of-type(14) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -1.75s; animation-delay: -1.75s; } @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(15) { -webkit-transform: rotate(270deg); transform: rotate(270deg); } body .wrap.two .inner .cell:nth-of-type(15) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -1.875s; animation-delay: -1.875s; } @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(16) { -webkit-transform: rotate(288deg); transform: rotate(288deg); } body .wrap.two .inner .cell:nth-of-type(16) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -2s; animation-delay: -2s; } @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(17) { -webkit-transform: rotate(306deg); transform: rotate(306deg); } body .wrap.two .inner .cell:nth-of-type(17) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -2.125s; animation-delay: -2.125s; } @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(18) { -webkit-transform: rotate(324deg); transform: rotate(324deg); } body .wrap.two .inner .cell:nth-of-type(18) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -2.25s; animation-delay: -2.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(19) { -webkit-transform: rotate(342deg); transform: rotate(342deg); } body .wrap.two .inner .cell:nth-of-type(19) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -2.375s; animation-delay: -2.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(20) { -webkit-transform: rotate(360deg); transform: rotate(360deg); } body .wrap.two .inner .cell:nth-of-type(20) svg path { -webkit-animation: shift2 1s ease-in-out infinite alternate; animation: shift2 1s ease-in-out infinite alternate; -webkit-animation-delay: -2.5s; animation-delay: -2.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 .inner { height: 0px; width: 0px; position: relative; } body .inner .cell { position: absolute; width: 100px; height: 100px; top: -150px; left: 50px; -webkit-transform-origin: 5px 85px; transform-origin: 5px 85px; } body .inner .cell:nth-of-type(1) { -webkit-transform: rotate(30deg); transform: rotate(30deg); } body .inner .cell:nth-of-type(1) svg path { -webkit-animation: shift 1s ease-in-out infinite alternate; animation: shift 1s ease-in-out infinite alternate; -webkit-animation-delay: -0.125s; animation-delay: -0.125s; } @-webkit-keyframes shift { 50% { d: path("M 0 300 Q 290 350 250 340 C 770 480 50 180 460 90 C 780 20 290 350 690 460 Q 740 480 800 500 "); } 100% { d: path("M 0 300 Q 110 300 190 310 C 280 320 320 330 380 340 C 460 360 530 380 590 400 Q 700 440 800 500 "); } } @keyframes shift { 50% { d: path("M 0 300 Q 290 350 250 340 C 770 480 50 180 460 90 C 780 20 290 350 690 460 Q 740 480 800 500 "); } 100% { d: path("M 0 300 Q 110 300 190 310 C 280 320 320 330 380 340 C 460 360 530 380 590 400 Q 700 440 800 500 "); } } body .inner .cell:nth-of-type(2) { -webkit-transform: rotate(60deg); transform: rotate(60deg); } body .inner .cell:nth-of-type(2) svg path { -webkit-animation: shift 1s ease-in-out infinite alternate; animation: shift 1s ease-in-out infinite alternate; -webkit-animation-delay: -0.25s; animation-delay: -0.25s; } @keyframes shift { 50% { d: path("M 0 300 Q 290 350 250 340 C 770 480 50 180 460 90 C 780 20 290 350 690 460 Q 740 480 800 500 "); } 100% { d: path("M 0 300 Q 110 300 190 310 C 280 320 320 330 380 340 C 460 360 530 380 590 400 Q 700 440 800 500 "); } } body .inner .cell:nth-of-type(3) { -webkit-transform: rotate(90deg); transform: rotate(90deg); } body .inner .cell:nth-of-type(3) svg path { -webkit-animation: shift 1s ease-in-out infinite alternate; animation: shift 1s ease-in-out infinite alternate; -webkit-animation-delay: -0.375s; animation-delay: -0.375s; } @keyframes shift { 50% { d: path("M 0 300 Q 290 350 250 340 C 770 480 50 180 460 90 C 780 20 290 350 690 460 Q 740 480 800 500 "); } 100% { d: path("M 0 300 Q 110 300 190 310 C 280 320 320 330 380 340 C 460 360 530 380 590 400 Q 700 440 800 500 "); } } body .inner .cell:nth-of-type(4) { -webkit-transform: rotate(120deg); transform: rotate(120deg); } body .inner .cell:nth-of-type(4) svg path { -webkit-animation: shift 1s ease-in-out infinite alternate; animation: shift 1s ease-in-out infinite alternate; -webkit-animation-delay: -0.5s; animation-delay: -0.5s; } @keyframes shift { 50% { d: path("M 0 300 Q 290 350 250 340 C 770 480 50 180 460 90 C 780 20 290 350 690 460 Q 740 480 800 500 "); } 100% { d: path("M 0 300 Q 110 300 190 310 C 280 320 320 330 380 340 C 460 360 530 380 590 400 Q 700 440 800 500 "); } } body .inner .cell:nth-of-type(5) { -webkit-transform: rotate(150deg); transform: rotate(150deg); } body .inner .cell:nth-of-type(5) svg path { -webkit-animation: shift 1s ease-in-out infinite alternate; animation: shift 1s ease-in-out infinite alternate; -webkit-animation-delay: -0.625s; animation-delay: -0.625s; } @keyframes shift { 50% { d: path("M 0 300 Q 290 350 250 340 C 770 480 50 180 460 90 C 780 20 290 350 690 460 Q 740 480 800 500 "); } 100% { d: path("M 0 300 Q 110 300 190 310 C 280 320 320 330 380 340 C 460 360 530 380 590 400 Q 700 440 800 500 "); } } body .inner .cell:nth-of-type(6) { -webkit-transform.........完整代码请登录后点击上方下载按钮下载查看
网友评论0