Skip to content

Instantly share code, notes, and snippets.

@broady
Last active June 1, 2017 16:44
Show Gist options
  • Save broady/6597401 to your computer and use it in GitHub Desktop.
Save broady/6597401 to your computer and use it in GitHub Desktop.
Dropping Marker animation
final Marker m = mMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.house_flag))
.position(new LatLng(lat, lng)));
final ValueAnimator va = ValueAnimator.ofFloat(20, 1);
va.setDuration(1500);
va.setInterpolator(new BounceInterpolator());
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
m.setAnchor(0f, (Float) animation.getAnimatedValue());
}
});
va.start();
final Marker m = mMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.house_flag))
.position(new LatLng(lat, lng)));
final ValueAnimator va = ValueAnimator.ofFloat(20, 1);
va.setDuration(500);
va.setInterpolator(new AccelerateInterpolator());
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
m.setAnchor(0f, (Float) animation.getAnimatedValue());
}
});
va.start();
@kimmiarora
Copy link

I have used this code, but markers are not animated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment