Files
leaflet/debug/vector/moving-canvas.html
Florian Bischof 20654cd159 Replace Mapbox with OpenStreetMap (#7818)
* Replace Mapbox with OpenStreetMap

Replace Mapbox with OpenStreetMap

* Revert Gemfile

* Replace blanks with tabs

* Fix lint

* Replace Mapbox with OSM

* Add OSM Tile Usage Policy link

* typo: productive→production

Co-authored-by: Iván Sánchez Ortega <ivan@sanchezortega.es>
2022-05-27 11:33:15 +03:00

52 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Leaflet debug page</title>
<link rel="stylesheet" href="../../dist/leaflet.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../css/screen.css" />
<script src="../../dist/leaflet-src.js"></script>
</head>
<body>
<div id="map"></div>
<script>
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
var map = L.map('map', {preferCanvas: true})
.setView([50.5, 30.51], 15)
.addLayer(osm);
var markers = [];
var colors = ['red', 'green', 'blue', 'purple', 'cyan', 'yellow'];
for (var i = 0; i < 20; i++) {
markers.push(L.circleMarker([50.5, 30.51], {color: colors[i % colors.length]}).addTo(map));
}
function update() {
var t = new Date().getTime() / 1000;
markers.forEach(function(marker, i) {
var v = t * (1 + i / 10) + (12.5 * i) / 180 * Math.PI;
marker.setLatLng([
50.5 + (i % 2 ? 1 : -1) * Math.sin(v) * 0.005,
30.51 + (i % 3 ? 1 : -1) * Math.cos(v) * 0.005,
]);
});
L.Util.requestAnimFrame(update);
}
update();
</script>
</body>
</html>