Marker or overlay moving animation moving smoothly in openlayers 3

المشرف العام

Administrator
طاقم الإدارة
I created a plunkr which has a moving marker like a car.

var olview = new ol.View({ center: [-5484111.13, -1884437.22], zoom: 18, minZoom: 2, maxZoom: 20});var osm = new ol.source.OSM();var lineString = new ol.geom.LineString([]);var map = new ol.Map({ target: 'map', view: olview, renderer: 'canvas', layers: [ new ol.layer.Tile({ source: osm, opacity: 0.6 }) ]});var car = document.getElementById('geo1');var marker = new ol.Overlay({ positioning: 'center-center', offset: [0, 0], element: car, stopEvent: false});map.addOverlay(marker);var path = [ [-5484101.57, -1884475.44], [-5484114.71, -1884432.74], [-5484117.70, -1884416.62], [-5484106.95, -1884392.28]];lineString.setCoordinates(path);map.once('postcompose', function(event) { interval = setInterval(animation, 500);});var i = 0, interval;var animation = function(){ if (i == path.length){ i = 0; } marker.setPosition(path); i++;};This is written in openlayers, I want it to look smooth when moving similar to this.

https://github.com/terikon/marker-animate-unobtrusive

I'm a complete beginner in openlayers, can someone help me with this?



أكثر...
 
أعلى