svg菜单动画效果
代码语言:html
所属分类:菜单导航
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> - SVG Icon Animations 1</title>
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #efefef;
font-family: 'Roboto';
}
body #wrap {
width: 400px;
height: 400px;
display: grid;
grid-template-columns: repeat(3, 25%);
grid-template-rows: repeat(3, 25%);
grid-column-gap: 12.5%;
grid-row-gap: 12.5%;
}
body #wrap .icon {
position: relative;
cursor: pointer;
box-sizing: border-box;
}
body #wrap .icon:nth-of-type(n + 4) {
-webkit-transform: translateX(75%);
transform: translateX(75%);
}
body #wrap .icon .inner {
position: absolute;
box-sizing: border-box;
width: 100%;
height: 100%;
left: 0;
top: 0;
border: 3px solid #1155cb;
box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0);
background: #fff;
border-radius: 100%;
transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.075);
}
body #wrap .icon:before {
position: absolute;
color: #c8a977;
bottom: -25px;
width: 100%;
text-align: center;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 12px;
pointer-events: none;
transition: 0.3s ease-in-out;
}
body #wrap .icon:after {
content: '';
position: absolute;
width: 50%;
height: 100%;
left: 25%;
top: 30px;
background: linear-gradient(to right, #c8a977, #c8a977);
background-size: 100% 2px;
background-repeat: no-repeat;
-webkit-animation: lineIn1 0.3s ease-in-out 1 forwards;
animation: lineIn1 0.3s ease-in-out 1 forwards;
}
@-webkit-keyframes lineIn1 {
from {
background-position: 0px 100%;
}
to {
background-position: 100px 100%;
}
}
@keyframes lineIn1 {
from {
background-position: 0px 100%;
}
to {
background-position: 100px 100%;
}
}
body #wrap .icon:hover .inner {
border-color: #c8a977;
}
body #wrap .icon:hover:after {
-webkit-animation: lineIn2 0.3s ease-in-out 1 forwards;
animation: lineIn2 0.3s ease-in-out 1 forwards;
}
@-webkit-keyframes lineIn2 {
from {
background-position: -100px 100%;
}
to {
background-position: 0px 100%;
}
}
@keyframes lineIn2 {
from {
background-position: -100px 100%;
}
to {
background-position: 0px 100%;
}
}
body #wrap .icon:hover:before {
color: #1155cb;
}
body #wrap .icon svg {
position: absolute;
width: 75%;
left: 12.5%;
top: 12.5%;
height: auto;
}
body #wrap .icon:nth-of-type(5):before {
content: 'teams';
}
body #wrap .icon:nth-of-type(5) svg g, body #wrap .icon:nth-of-type(5) svg path, body #wrap .icon:nth-of-type(5) svg circle {
stroke-width: 1.5;
}
body #wrap .icon:nth-of-type(5):hover svg g {
-webkit-animation: clipIn 3s ease-in-out infinite alternate;
animation: clipIn 3s ease-in-out infinite alternate;
}
@-webkit-keyframes clipIn {
0% {
-webkit-clip-path: polygon(-10% 110%, 110% 110%, 110% 110%, -10% 110%);
clip-path: polygon(-10% 110%, 110% 110%, 110% 110%, -10% 110%);
}
15% {
-webkit-clip-path: polygon(-10% 110%, 110% 110%, 110% 110%, -10% 110%);
clip-path: polygon(-10% 110%, 110% 110%, 110% 110%, -10% 110%);
}
30% {
-webkit-clip-path: polygon(-10% -10%, 110% -10%, 110% 110%, -10% 110%);
clip-path: polygon(-10% -10%, 110% -10%, 110% 110%, -10% 110%);
}
100% {
-webkit-clip-path: polygon(-10% -10%, 110% -10%, 110% 110%, -10% 110%);
clip-path: polygon(-10% -10%, 110% -10%, 110% 110%, -10% 110%);
}
}
@keyframes clipIn {
0% {
-webkit-clip-path: polygon(-10% 110%, 110% 110%, 110% 110%, -10% 110%);
clip-path: polygon(-10% 110%, 110% 110%, 110% 110%, -10% 110%);
}
15% {
-webkit-clip-path: polygon(-10% 110%, 110% 110%, 110% 110%, -10% 110%);
clip-path: polygon(-10% 110%, 110% 110%, 110% 110%, -10% 110%);
}
30% {
-webkit-clip-path: polygon(-10% -10%, 110% -10%, 110% 110%, -10% 110%);
clip-path: polygon(-10% -10%, 110% -10%, 110% 110%, -10% 110%);
}
100% {
-webkit-clip-path: polygon(-10% -10%, 110% -10%, 110% 110%, -10% 110%);
clip-path: polygon(-10% -10%, 110% -10%, 110% 110%, -10% 110%);
}
}
body #wrap .icon:nth-of-type(5):hover svg > g > path:nth-of-type(3), body #wrap .icon:nth-of-type(5):hover svg > g > path:nth-of-type(4) {
stroke-dasharray: 150px;
-webkit-animation: drawIn3 3s ease-in-out infinite alternate;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0