每200毫秒,我正在改变地图的视图。
我正在通过添加50米来更改视图中心的lon / lat值。
以下是用于设置视图的jsfiddle和我的函数:“https://jsfiddle.net/salmanb1/14hke7k1/16/”
function animate(){
centerPoint[0] = centerPoint[0] + 50;
centerPoint[1] = centerPoint[1] + 50;
proj_view.setCenter(centerPoint);
render();
可以看出,视图在变化时会产生抖动。
有没有办法顺利改变观点?
答案 0 :(得分:1)
查看Animation example in OpenLayers,它可以为您提供如何改进您尝试做的动画的建议。
答案 1 :(得分:0)
尝试以下剪辑以查看您的预期行为是否符合要求。您不需要设置新中心,而是要求为新中心设置动画
function animate(){
centerPoint[0] = centerPoint[0] + 50;
centerPoint[1] = centerPoint[1] + 50;
proj_view.animate({zoom: proj_view.getZoom()}, {center: centerPoint});
}
有几个选项可用于调整动画 - > http://openlayers.org/en/latest/apidoc/ol.View.html#animate