sharewire / google-maps-clustering

Fast marker clustering library for Google Maps Android API.
Apache License 2.0
292 stars 77 forks source link

Animate cluster when visible #1

Closed webserveis closed 6 years ago

webserveis commented 6 years ago

Great library, right now I was looking for a solution whith clustering...

I see in the demo/gir that the cluster is hidden and shown only when necessary

Is posible add animate fade-in when cluster is needed draw in viewport? Similar objects in google maps, labels, icons...

Or other feature, posible set factor viewport "visible" increase the viewport as if it were 1.2f, so the clusters are pre-loaded before being visualized

makovkastar commented 6 years ago
  1. You are right, only the markers, that are inside a visible camera rect are rendered. Regarding the marker appear animation: I think it's a good idea, but the Marker class doesn't expose any methods to change its transparency. If you find the way to animate the appearance of a marker - let me know.
  2. I wanted the library to be as fast as possible, so I decided to minimize the amount of rendered markers.
webserveis commented 6 years ago

Look https://developers.google.com/android/reference/com/google/android/gms/maps/model/Marker

Alpha Sets the opacity of the marker. Defaults to 1.0.

I found this for animate fadeIn https://stackoverflow.com/questions/19753765/maps-v2-marker-animation-fade-in-and-out

ObjectAnimator.ofFloat(marker, "alpha", 0f, 1f).setDuration(500).start();

makovkastar commented 6 years ago

Oh, I see, thanks. I somehow overlooked the method. I could try adding the appearing animation and see how it will look.

makovkastar commented 6 years ago

I have implemented the appearance animation. Check this commit: https://github.com/sharewire/google-maps-clustering/commit/c5652fd871d0b8d358fb9b7a8ef9f58c55d283c1. I will release a new version soon.