如何使用openlayers进行动画缩放和平移?

tip*_*lip 2 openlayers

喜欢的网站:http://www.tomtom.com/livetraffic/

当我在上面的网站上尝试平移或缩放时,感觉非常类似于Google地图,这种用户体验非常顺畅.

我的问题是如何分别使用openlayers实现此效果的平移和缩放?我至少在openlayers的例子中找不到它们.

谢谢你的关注.

以下是我的源代码的一部分,也许它的工作原理但不如我想的那么顺利

        var map, layer; 
        function init() {
            var options = { 
                projection: "EPSG:900913",

                maxExtent: new OpenLayers.Bounds(18.203001,
Run Code Online (Sandbox Code Playgroud)

47.078001,399.909001,261.796001),

                scales: [2400, 1200, 600, 300, 150],
                units: "m",

                panDuration: 100,
                controls: [new OpenLayers.Control.Navigation(
        {dragPanOptions: {enableKinetic: true}}
    )]
             var tile = new SimpleTileCache("map", 
Run Code Online (Sandbox Code Playgroud)

"tilecache/8f /",
{'format':'image/png',transitionEffect:'resize'});

             map.addLayers([tile]);
Run Code Online (Sandbox Code Playgroud)

Myr*_*yra 11

效果称为transitionEffect
您可以通过更改layers属性将此效果实现到代码中.
我想你有一个WMS或TMS层.

 var tiled_resize_effect = new OpenLayers.Layer.WMS(
     "WMS tiled resize", 
     "http://vmap0.tiles.osgeo.org/wms/vmap0?",
     {layers: 'basic'}, 
     {transitionEffect: 'resize'}
 );
Run Code Online (Sandbox Code Playgroud)

查看这些示例

WMS过渡
谷歌过渡

最好的祝福