Demo google map marker animate a marker complex
RUN
<!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>Simple icons</title> <style> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } </style> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDfNk5eVWmQB9e6ApnWzICLNIY5lUXpOBw&language=vi"></script> <script> // Trong ví dụ này ta sẽ tạo một complex markers bãi biển gần Sydney, NSW, Australia. function initialize() { var mapOptions = { zoom: 10, center: new google.maps.LatLng(-33.9, 151.2) }; var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); setMarkers(map, beaches); } // Danh sahcs Địa Điểm var beaches = [ ['Bondi Beach', -33.890542, 151.274856, 4], ['Coogee Beach', -33.923036, 151.259052, 5], ['Cronulla Beach', -34.028249, 151.157507, 3], ['Manly Beach', -33.80010128657071, 151.28747820854187, 2], ['Maroubra Beach', -33.950198, 151.259302, 1] ]; function setMarkers(map, locations) { // Icon Image Marker var image = { url: 'https://freetuts.net/public/javascript/i18n/flags/vi.png', // Kích cỡ hình size: new google.maps.Size(50, 50), // Gốc cho hình là oo origin: new google.maps.Point(0, 0), // Neo cho hình là 0, 32 anchor: new google.maps.Point(50, 50) }; // Hình dạng var shape = { coords: [1, 1, 1, 20, 18, 20, 18, 1], type: 'poly' }; // Lặp qua từng locations for (var i = 0; i < locations.length; i++) { var beach = locations[i]; var myLatLng = new google.maps.LatLng(beach[1], beach[2]); var marker = new google.maps.Marker({ position: myLatLng, map: map, icon: image, shape: shape, title: beach[0], zIndex: beach[3] }); } } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body> <div id="map-canvas"></div> </body> </html>
PHÓNG TO