javascript Google MAP API v3:在两个位置之间移动中心

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6594731/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 21:13:24  来源:igfitidea点击:

Google MAP API v3: Move center between two locs

javascriptgoogle-maps

提问by Hellnar

How can I move the camera from one loc to another loc ? I have checked the API but I couldn't find what I want beside the setCentermethod which directly sets the center to the given location but I want to a smooth transtition, not an instant center change.

如何将相机从一个位置移动到另一个位置?我已经检查了 API,但除了setCenter直接将中心设置为给定位置的方法之外,我找不到我想要的内容,但我想要平滑过渡,而不是即时中心更改。

回答by katspaugh

http://code.google.com/apis/maps/documentation/javascript/reference.html#Map

http://code.google.com/apis/maps/documentation/javascript/reference.html#Map

Method panTo.

方法panTo

Changes the center of the map to the given LatLng. If the change is less than both the width and height of the map, the transition will be smoothly animated.

将地图的中心更改为给定的 LatLng。如果变化小于地图的宽度和高度,过渡将平滑动画。