設(shè)置自定義定位藍(lán)點(diǎn)
自定義Marker標(biāo)記點(diǎn),呼吸閃爍的動(dòng)畫
貼出代碼狐血,學(xué)習(xí)高德地圖官方demo
// 呼吸動(dòng)畫
if(breatheMarker == null) {
LatLng latLng = new LatLng(latlng.latitude - 0.02, latlng.longitude - 0.02);
breatheMarker = aMap.addMarker(new MarkerOptions().position(latLng).zIndex(1)
.anchor(0.5f,0.5f).icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_circle_64)));
// 中心的marker
breatheMarker_center = aMap.addMarker(new MarkerOptions().position(latLng).zIndex(2)
.anchor(0.5f,0.5f).icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_circle_64)));
}
// 動(dòng)畫執(zhí)行完成后迷扇,默認(rèn)會(huì)保持到最后一幀的狀態(tài)
AnimationSet animationSet = new AnimationSet(true);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f, 0f);
alphaAnimation.setDuration(2000);
// 設(shè)置不斷重復(fù)
alphaAnimation.setRepeatCount(Animation.INFINITE);
ScaleAnimation scaleAnimation = new ScaleAnimation(1, 3.5f, 1, 3.5f);
scaleAnimation.setDuration(2000);
// 設(shè)置不斷重復(fù)
scaleAnimation.setRepeatCount(Animation.INFINITE);
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(scaleAnimation);
animationSet.setInterpolator(new LinearInterpolator());
breatheMarker.setAnimation(animationSet);
breatheMarker.startAnimation();