1.线路图
先用svg绘制,线路图,画出几条线路,然后根据线路的起始坐标,添加动态效果,出现电流流动效果。
线路图源码
<svg id="svg" width="calc(100% - 4px)" height="calc(100% - 4px)" version="1.1"
xmlns="http://www.w3.org/2000/svg" style="border:2px solid #ccc;">
<g id="global_box" transform="translate(0,0)">
<line x1="100" y1="100" x2="300" y2="100" stroke="black" stroke-width="1"
transform="matrix(1,0,0,1,47.99999894389384,7.999999816329364)">
</line>
<circle cx="100" cy="100" r="10" stroke="#1F96DC" stroke-width="1" fill="#031546"
transform="matrix(1,0,0,1,222.99999488018102,7.99999933949222)" id="t2">
</circle>
<line x1="100" y1="100" x2="300" y2="100" stroke="black" stroke-width="1"
transform="matrix(6.123233601181349e-17,1,-1,6.123233601181349e-17,286.99999341081593,5.999999362451035)">
</line>
<circle cx="100" cy="100" r="10" stroke="#1F96DC" stroke-width="1" fill="#031546"
transform="matrix(1,0,0,1,86.99999800258183,8.00000126979964)" id="t1">
</circle>
<circle cx="100" cy="100" r="10" stroke="#1F96DC" stroke-width="1" fill="#031546"
transform="matrix(1,0,0,1,86.99999035022864,114.9999973597346)" id="t3">
</circle>
</g>
</svg>
线路图效果
2.html线路流动效果
利用svg线路图线路的stroke-dasharray和css的动画效果animation的结合,实现线路流动效果。
html源码
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>svg线路动态效果</title>
<style style="text/css">
.svgLineDL{
stroke-dasharray:0% 100% ;
stroke:#FCFCEC;
animation:move2 1s infinite;
}
@keyframes move2{
0%{
stroke-dasharray:0,100%;
}
100%{
stroke-dasharray:100%,0;
stroke:#C30000;
}
}
</style>
</head>
<body>
<svg id="svg" width="calc(100% - 4px)" height="calc(100% - 4px)" version="1.1" xmlns="http://www.w3.org/2000/svg" style="border:2px solid #ccc;">
<g id="global_box" transform="translate(0,0)">
<line x1="100" y1="100" x2="300" y2="100" stroke="black" stroke-width="1"
transform="matrix(1,0,0,1,47.99999894389384,7.999999816329364)">
</line>
<circle cx="100" cy="100" r="10" stroke="#1F96DC" stroke-width="1" fill="#031546"
transform="matrix(1,0,0,1,222.99999488018102,7.99999933949222)" id="t2">
</circle>
<line x1="100" y1="100" x2="300" y2="100" stroke="black" stroke-width="1"
transform="matrix(6.123233601181349e-17,1,-1,6.123233601181349e-17,286.99999341081593,5.999999362451035)">
</line>
<circle cx="100" cy="100" r="10" stroke="#1F96DC" stroke-width="1" fill="#031546"
transform="matrix(1,0,0,1,86.99999800258183,8.00000126979964)" id="t1">
</circle>
<circle cx="100" cy="100" r="10" stroke="#1F96DC" stroke-width="1" fill="#031546"
transform="matrix(1,0,0,1,86.99999035022864,114.9999973597346)" id="t3">
</circle>
<line x1="187" y1="108" x2="323" y2="108" stroke="#C30000" stroke-width="2">
</line>
<line x1="187" y1="108" x2="323" y2="108" stroke="#C30000" class="svgLineDL"
stroke-width="2">
</line>
<line x1="187" y1="215" x2="187" y2="108" class="svgLineDL" stroke="#C30000"
stroke-width="2">
</line>
</g>
</svg>
</svg>
</body>
</html>
3.动态效果
可以实现点到点的线路流动,也可以实现单一线路流动,也支持多分支线路流动。
4.svg相关资源
🧡💛💚💙💜【博主推荐】html引用百度地图定位闪烁弹框树形(附源码)
优质资源分享
🧡🧡🧡🧡🤍【博主推荐】JAVA SSM框架的后台管理系统(附源码)
🧡🧡🧡🧡🤍【博主推荐】SpringBoot API接口对数据库增删改查,路由,TOKEN,WebSocket完整版(附源码)
🧡🧡🧡🧡🤍【博主推荐】HTML制作一个美观的个人简介网页(附源码)
🧡🧡🧡🧡🤍【博主推荐】html好看的个人简历网页版(附源码)
🧡🧡🧡🧡🤍【博主推荐】html下拉框树形(附好看的登录界面)
🧡🧡🧡🧡🧡【博主推荐】html引用百度地图定位闪烁弹框树形(附源码)
🧡🧡🧡🧡🤍【博主推荐】HTML酷炫动画表白求爱界面(附源码)
💞 关注博主 带你实现畅游前后端
🏰 加入社区 带你体验马航不孤单
💯 神秘个人简介 带你体验不一样得介绍
🎀 酷炫邀请函 带你体验高大上得邀请
亲,码字不易,动动小手,欢迎 点赞 ➕ 收藏,如 🈶 问题请留言(评论),博主看见后一定及时给您答复,💌💌💌