CSS代码:
.towns-cricle { width: 120px; height: 120px; background-color: transparent; position: absolute; left: 0; top: 0; z-index: 1000; color: #00eaff; } .towns-cricle .circle { width: 50%; height: 50%; background-color: #1774dc; position: absolute; z-index: 10; border-radius: 50%; top: 25%; left: 25%; } .towns-cricle .circle-aniamte { top: 35%; left: 35%; background-color: #ef9338; } .towns-cricle .circle1 { width: 100%; height: 100%; border-radius: 50%; opacity: 0.5; position: absolute; top: 0; left: 0; z-index: 10; -webkit-animation: halo 3.5s infinite; -moz-animation: halo 3.5s infinite; animation: halo 3.5s infinite; } .towns-cricle .circle2 { width: 70%; height: 70%; border-radius: 50%; opacity: 0.5; position: absolute; top: 18px; left:18px; z-index: 11; -webkit-animation: halo 2s infinite; -moz-animation: halo 2s infinite; animation: halo 2s infinite; } .towns-cricle .liner { background-image: radial-gradient(transparent 40%, #1c87ff 70%); } .towns-cricle .big-liner { background-image: radial-gradient(transparent 40%, #ef9338 70%); width: 120%; height: 120%; } .towns-cricle .big-width { width: 120% !important; height: 120% !important; } .towns-cricle .big-width2 { width: 90%; height: 90%; } .towns-cricle .big-name { color: #fff !important; } .towns-cricle .circle-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; text-align: center; z-index: 12; display: flex; flex-direction: column; align-items: center; justify-content: center; } .towns-cricle .circle-text .name { font-size:16px; margin-top: -5px; } .towns-cricle .circle-text .text-liner { background-image: linear-gradient(#fff 0%, #ffa200 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } .towns-cricle .circle-text .text-big-liner { color: #fff; } .towns-cricle .circle-text p { margin: 0; } .towns-cricle .circle-text p .text { font-size: 16px; font-weight: bold; } .towns-cricle .circle-text p .home { font-size: 16px; font-weight: bold; } @keyframes halo { 0% { opacity: 0; transform: scale(0.1); } 50% { opacity: 1; } 100% { opacity: 0; transform: scale(1.2); } }
js代码:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Clustering points</title> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> <!-- Load Leaflet from CDN--> <link rel="stylesheet" href="./esri-leaflet-v2.5.3/leaflet.css" /> <link rel="stylesheet" href="./animateMarker.css"> <script src="./esri-leaflet-v2.5.3/leaflet.js"></script> <!-- Load Esri Leaflet --> <script src="./esri-leaflet-v2.5.3/esri-leaflet.js"></script> <link rel="stylesheet" type="text/css" href="./esri-leaflet-v2.5.3/leaflet.markercluster/dist/MarkerCluster.Default.css"> <link rel="stylesheet" type="text/css" href="./esri-leaflet-v2.5.3/leaflet.markercluster/dist/MarkerCluster.css"> <script src="./esri-leaflet-v2.5.3/leaflet.markercluster/dist/leaflet.markercluster.js"></script> <script src="./esri-leaflet-v2.5.3/esri-leaflet-cluster/dist/esri-leaflet-cluster.js"></script> <script src="./leaflet.motion.js"></script> <style> body { margin: 0; padding: 0; } #map { position: absolute; top: 0; bottom: 0; right: 0; left: 0; } </style> </head> <body> <div id="map"></div> <script> L.animateMarker = function (point, options) { const html = `<div class="towns-cricle"> <div class="circle "></div> <div class="circle1 liner"></div> <div class="circle2 liner"></div> <div class="circle-text "> <p><span class="text text-liner">${options.number}</span><span class="home text-liner">${options.unit}</span></p> <p class="name ">${options.name}</p> </div> </div>` var myIcon = L.divIcon({ className: 'my-div-icon', html: html }); var marker = L.marker(point, { icon: myIcon, title: '123213' }); return marker; } var map = L.map('map', { zoomControl: false }).setView([30.65, 104.05], 10); L.animateMarker([30.65, 104.05], { number: 15, unit: '家', name: '广东省' }).addTo(map).on('click', e => { console.log(e) }) L.esri.basemapLayer('Streets').addTo(map); </script> </body> </html>
发表评论
侧栏公告
寄语
譬如朝露博客是一个分享前端知识的网站,联系方式11523518。
热评文章
标签列表
热门文章
友情链接