Hi all, I'm fairly new to this all so don't burn me down just yet...
After I discovered that there is no good way to animate Markers across the
map (in fact the only animations available are the DROP and BOUNCE ones
upon creation), I decided to create my own class that can do this. It's
attached to this message.
I tried to follow the Maps v3 style of object specification as much as
possible. Here's a usage example:
marker.animation = new MarkerMoveAnimation(marker,
{
name: name
,from: start
,to: new google.maps.LatLng(-33, 150)
,duration: 500
,effect: 'easeout'
,onStep: function(e)
{
e.marker.leash.setPath([start, e.marker.getPosition()]);
}
,onComplete: function(e)
{
animating = false;
}
})
See the source for the full class capabilities, it is not that hard to
understand. It supports the callbacks onBeforeStart, onStep (fires on each
step of the animation) and onComplete (whenever an animation is stopped,
can also be invoked when directly calling stop() on the instance. The
callbacks get the object instance passed along, so you can access the
marker and it's methods.
1. Is this helpful?
2. Please give feedback on code efficiency, bugs, etc.
3. Where should I go with this? Should I create a google code project or
just place it somewhere online?
4. Maybe there is a need for a generic animation class that allows for
opacity (fade in/out) animation and possibly other things as well?
I personally use this class to animate markers that are too close together
which makes it too hard sometimes to click the markers.
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-maps-js-api-v3/-/pUeQkMKhJiAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.
google.maps.animatemarker.js
Description: JavaScript source
