问题描述
我想改善用OpenLayer显示的地图的加载体验.目前,新图块的加载还不太顺利,尤其是在地图的空白区域中加载图块时.我想动画化新瓷砖的外观,例如,通过播放要显示的新图像的不透明度来制作动画.我感觉这就是传单正在做的事情.
I would like to improve the loading experience of my maps displayed with OpenLayer. At the moment, the loading of new tiles is not very smooth, especially when loading tiles in an empty area of the map. I would like to animate the apparition of the new tile, for example by playing with the opacity of the new image to display. I have the feeling that this is what leaflet is doing.
问题是,当准备好显示图块时,我没有找到一种聆听的方法,甚至以后如何对其进行动画处理也没有.
The problem is that I did not find a way to listen when a tile is ready to be displayed and even less how to animate it afterward.
解决此问题的最佳方法是什么?也许我朝着错误的方向前进.
What is the best way to tackle this issue? Maybe I am heading in the wrong direction.
推荐答案
您将在 ol.Map
像这样:
You will use loadTilesWhileAnimating
and loadTilesWhileInteracting
on ol.Map
like:
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
// Improve user experience by loading tiles while animating. Will make
// animations stutter on mobile or slow devices.
loadTilesWhileAnimating: true,
loadTilesWhileInteracting: true,
view: view
});
这篇关于在OpenLayer中平滑加载瓷砖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!