如何在 OpenLayers 3 中动态移动矢量特征

How to dynamically move Vector Features in OpenLayers 3

基于此处给出的示例:http://openlayers.org/en/vector-api/examples/dynamic-data.html?q=dynamic

而不是使用圆:

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

我想使用矢量特征(标记)作为移动的对象,而不是使用那个黄色圆圈。

在这里可以找到使用特征向量的示例:

how to add markers with OpenLayers 3

抱歉,我只是 OpenLayers 3 的初学者。希望有人能帮助我。谢谢!

我成就了你a basic example

想法是:您使用一个间隔在路径中移动叠加层以更改其位置,例如:

//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++;
};