Last active
June 1, 2017 16:44
-
-
Save broady/6597401 to your computer and use it in GitHub Desktop.
Dropping Marker animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have used this code, but markers are not animated.