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.
精彩评论