1

Based from an example given here: http://openlayers.org/en/vector-api/examples/dynamic-data.html?q=dynamic

Instead of using circle:

var imageStyle = new ol.style.Circle({
    radius: 5,
    fill: new ol.style.Fill({color: 'yellow'}),
    stroke: new ol.style.Stroke({color: 'red', width: 1})
});

I want to use Vector Feature (Marker) as the object which is moving instead of using that yellow circle.

An example of using a feature vector is found here:

how to add markers with OpenLayers 3

Sorry, just a beginner in OpenLayers 3. Hope someone can help me. Thanks!

Community
  • 1
  • 1
The Bassman
  • 2,241
  • 5
  • 26
  • 38

1 Answers1

2

I've made you a basic example.

The idea is: You move an Overlay through a path using an interval to change its position like:

//fire the animation
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]);
    i++;
};
Jonatas Walker
  • 13,583
  • 5
  • 53
  • 82