开发者

How to limit the number of times a google maps marker bounces?

开发者 https://www.devze.com 2023-03-18 02:31 出处:网络
I\'m using animation in google maps to cause a marker to bounce. How can I change the following code 开发者_Python百科to make it bounce only twice?

I'm using animation in google maps to cause a marker to bounce.

How can I change the following code 开发者_Python百科to make it bounce only twice?

markersArray[i].setAnimation(google.maps.Animation.BOUNCE);

EDIT:

Here's how I did it but as Michal said - it's a crude solution:

marker.setAnimation(google.maps.Animation.BOUNCE);
setTimeout("marker.setAnimation(null)", 1520);


Currently you cannot control the animation via the API.

A crude way of stopping the animation would be to time exactly how long two bounces last, setTimeout to that value and cancel the animation with marker.setAnimation(null);


I took that "crude way of stopping the animation" and refined it a little in my answer on this other (dup) SO post.

0

精彩评论

暂无评论...
验证码 换一张
取 消