Skip to content

Instantly share code, notes, and snippets.

@KoGor
Created August 14, 2014 14:15
Show Gist options
  • Save KoGor/81e6ce8945c43405e3e9 to your computer and use it in GitHub Desktop.
Save KoGor/81e6ce8945c43405e3e9 to your computer and use it in GitHub Desktop.
Leaflet: animated marker

Simple animated marker: SVG marker + SMIL.

Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8 />
<title>Animated marker</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
</style>
</head>
<body>
<div id="map" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></div>
<script src="ma.js"></script>
</body>
</html>
The MIT License (MIT)
Copyright (c) 2014 [KoGor](https://github.com/KoGor)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
stamenUrl = 'http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png',
attrib = '&copy; Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> | <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
main = L.tileLayer(stamenUrl, {maxZoom: 18, attribution: attrib}),
map = new L.Map('map', {
layers: [main],
center: [55.7501, 37.6687],
zoom: 11
});
var myIcon = L.icon({
iconUrl: 'bike.svg',
iconSize: [75, 75],
iconAnchor: [37.5, 75]
});
L.marker([55.7501, 37.6687], {icon: myIcon}).addTo(map);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment