svg的几个小案例
最近经常用到svg,闲的无聊的时候做了几个简单的小例子,希望能帮到大家,svg会用了之后做动画和图片都方便了好多,接下来就看看小例子吧!!
1、例子一

css代码
html, body {
width: 100%;
height: 100%;}body {
background: #131518;}#patt1 path {
stroke: #ff509e;}#patt2 path {
stroke: #95d13c;}#patt3 path {
stroke: #00b6cb;}#patt4 path {
stroke: #9753e1;}#mask1 rect {
-webkit-animation: pulse 1.90476s infinite; animation: pulse 1.90476s infinite;
-webkit-animation-timing-function: cubic-bezier(0.445, 0.05, 0.55, 0.95); animation-timing-function: cubic-bezier(0.445, 0.05, 0.55, 0.95);}#mask2 rect {
x: 10;
-webkit-animation: pulse 1.90476s infinite 0.47619s; animation: pulse 1.90476s infinite 0.47619s;
-webkit-animation-timing-function: cubic-bezier(0.445, 0.05, 0.55, 0.95); animation-timing-function: cubic-bezier(0.445, 0.05, 0.55, 0.95);}#squiggle1, #squiggle2, #squiggle3, #squiggle4 {
background-blend-mode: multiply;}@-webkit-keyframes pulse {
0% {x: 10;
}
50% {x: -20;
}
100% {x: -50;
}}
@keyframes pulse {
0% {x: 10;
}
50% {x: -20;
}
100% {x: -50;
}}html代码
例子二

css代码
.st0{fill:none;stroke:#000000;stroke-miterlimit:10;}.st1{fill:#7100BF;stroke:#000000;stroke-miterlimit:10;}.box{width: 600px;height: 600px;}html代码
例子三

css代码
.st0{fill:#09E900;}.st1{fill:#9C55FF;}.st2{fill:#FF2A56;}.st3{fill:#FFFE6A;}.st4{fill:#2AFFF5;}#logo.animate #g1 path{animation:2s dong;}#logo.animate #g1 path#h{animation-delay:0.3s;}#logo.animate #g1 path#i{animation-delay:0.6s;}#logo.animate #g1 path#t{animation-delay:0.9s;}#logo.animate #g1 path#u{animation-delay:1.2s;}@keyframes dong{from{transform:scale(1.0);}to{transform:scale(1.1);}}html代码
js代码
var btn = document.querySelector("#btn");var logo = document.querySelector("#logo");var paths = document.querySelectorAll("#g1 path");btn.addEventListener("click", function(){logo.classList.toggle("animate");});var count = 0;for (var i = 0, l = paths.length; i < l;i++) {paths[i].addEventListener("webkitAnimationEnd",function(){count++;if(count>5){logo.classList.toggle("animate");count = 0;}})};SVG有什么优势?
人人站CMS是全新内核且开源免费的PHP企业网站开发建设管理系统,是一套高效、简洁、 强悍的PHP CMS源码,能够满足各类企业网站开发建设的需要。系统采用简单的模板标签,只要懂HTML就可快速开发企业网站。官方提供了大量网站模板免费下载和使用,将致力于为广大站长和企业提供简单易用的网站开发建设解决方案。模板特点: 1、安装即用,自带人人站CMS内核及企业站展示功能(产品,新闻,案例展示等),并可
文件体积小,能够被大量的压缩
图片可无限放大而不失真(矢量图的基本特征)
在视网膜显示屏上效果极佳
能够实现互动和滤镜效果









