[英]Animate map Marker in GoogleMaps API
我做了一些非常相似的事情,但我使用了 GroundOverlay 而不是标记,首先我定义了我的自定义动画:
public class RadiusAnimation extends Animation {
private GroundOverlay groundOverlay;
public RadiusAnimation(GroundOverlay groundOverlay) {
this.groundOverlay = groundOverlay;
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
groundOverlay.setDimensions( (100 * interpolatedTime) );
groundOverlay.setTransparency( interpolatedTime );
}
@Override
public void initialize(int width, int height, int parentWidth,int parentHeight) {
super.initialize(width, height, parentWidth, parentHeight);
}
}
然后我在 onMapReady 之后在 groundOverlay 上运行动画:
...
groundOverlay = mGoogleMap.addGroundOverlay(new GroundOverlayOptions()
.image(image)
.position(new LatLng(lat, lng), 100));
groundAnimation = new RadiusAnimation(groundOverlay);
groundAnimation.setRepeatCount(Animation.INFINITE);
groundAnimation.setRepeatMode(Animation.RESTART);
groundAnimation.setDuration(2000);
mapView.startAnimation(groundAnimation); // MapView where i show my map
...
我希望这可以帮助你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.