anime实现svg动画效果
代码语言:html
所属分类:动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Fira Sans', sans-serif;
font-size: 16px;
color: #2c2c2c;
}
body a {
color: inherit;
text-decoration: none;
}
.btn {
-webkit-transition-property: all;
transition-property: all;
-webkit-transition-duration: 0.2s;
transition-duration: 0.2s;
-webkit-transition-timing-function: linear;
transition-timing-function: linear;
-webkit-transition-delay: 0s;
transition-delay: 0s;
padding: 10px 20px;
display: inline-block;
margin-right: 10px;
background-color: #fff;
border: 1px solid #2c2c2c;
border-radius: 3px;
cursor: pointer;
outline: none;
}
.btn:last-child {
margin-right: 0;
}
.btn:hover, .btn.js-active {
color: #fff;
background-color: #2c2c2c;
}
.header {
max-width: 600px;
margin: 50px auto;
text-align: center;
}
.header__title {
margin-bottom: 30px;
font-size: 2.1rem;
}
.content {
width: 95%;
margin: 0 auto 50px;
}
.content__inner {
display: grid;
grid-template-columns: repeat(5, 100px);
grid-gap: 60px;
-webkit-box-pack: center;
justify-content: center;
}
.icon-block {
width: 100px;
text-align: center;
}
.icon-block .icon {
width: 100%;
height: 100px;
}
.icon-block svg {
width: 100%;
height: 100%;
overflow: visible;
}
.icon-block__replay {
margin-top: 15px;
}
</style>
</head>
<body translate="no">
<header class="header">
<h1 class="header__title">SVG icon animations with Anime.js</h1>
<div class="header__btns btns">
<a class="header__btn btn" href="https://github.com/nat-davydova/svg-animations-1" title="Check on Github" target="_blank">Check on Github</a>
</div>
</header>
<div class="content">
<div class="content__inner">
<div class="icon-block">
<div class="cart-icon icon">
<svg height="426pt" viewBox="-6 0 426 426.82755" width="426pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path class="arrow" fill="#fff" stroke="#000" stroke-width="3" d="m207.859375 80.316406 35 30c.007813.007813.023437.015625.035156.023438.289063.246094.597657.464844.925781.660156.042969.027344.085938.054688.128907.078125.320312.179687.648437.335937.992187.464844l.160156.058593c.339844.121094.6875.210938 1.042969.277344l.15625.023438c.738281.128906 1.488281.128906 2.226563 0l.15625-.023438c.355468-.066406.703125-.15625 1.042968-.277344l.160157-.058593c.339843-.128907.671875-.285157.988281-.464844.046875-.023437.089844-.050781.132812-.078125.328126-.195312.636719-.414062.925782-.660156.011718-.007813.023437-.015625.035156-.023438l35-30c2.9375-2.519531 3.277344-6.9375.757812-9.871094-2.515624-2.9375-6.933593-3.277343-9.867187-.757812l-23.445313 20.09375v-82.78125c0-3.867188-3.132812-7-7-7-3.867187 0-7 3.132812-7 7v82.78125l-23.445312-20.09375c-2.933594-2.519531-7.351562-2.179688-9.871094.757812-2.515625 2.933594-2.175781 7.351563.761719 9.871094zm0 0"></path>
<path class="cart" fill="#fff".........完整代码请登录后点击上方下载按钮下载查看
















网友评论0