Javascript 使用 google map js api v3 动画路线

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11519386/
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-08-24 06:08:54  来源:igfitidea点击:

Animate a route with google map js api v3

javascriptgoogle-mapsanimationgoogle-maps-api-3

提问by xavier.seignard

Given two geo-localized points (start and end of the route), I want to animate the drawing of the route between them.

给定两个地理定位点(路线的起点和终点),我想为它们之间的路线绘制动画。

Do you know how if it's achievable with the Google map js v3 api?

您知道如何使用 Google map js v3 api 实现吗?

Thanks

谢谢

回答by Suyash Dixit

I found something for you.

我为你找到了一些东西。

http://www.geocodezip.com/v3_animate_marker_directions.htmlVisit this website hit F12 on chrome go to sources tab and select v3-animate-marker-direction.html You'll the complete code of it on how it is used. I you need help on it, kindly comment

http://www.geocodezip.com/v3_animate_marker_directions.html访问此网站 在 chrome 上按 F12 转到源选项卡并选择 v3-animate-marker-direction.html 您将获得有关如何使用它的完整代码。我需要帮助,请评论

and a pretty good example here also, but I guess it is implemented on v2 http://www.kmcgraphics.com/google/

这里也是一个很好的例子,但我想它是在 v2 http://www.kmcgraphics.com/google/ 上实现的

Regards, Suyash

问候, 苏亚什

回答by sTg

Using this Exampleyou can animate more than one markers within the route. the animate and startAnimation functions handle multiple markers. You can modify the code based on your requirement. Hope it helps.

使用此示例,您可以为路线内的多个标记设置动画。animate 和 startAnimation 函数处理多个标记。您可以根据需要修改代码。希望能帮助到你。

回答by Viacheslav aka Lordz

In this example:

在这个例子中

var symbolTwo = {
  path: 'M -1,0 A 1,1 0 0 0 -3,0 1,1 0 0 0 -1,0M 1,0 A 1,1 0 0 0 3,0 1,1 0 0 0 1,0M -3,3 Q 0,5 3,3',
  strokeColor: '#00F',
  **rotation**: 45
};