Android 高德地图 小蓝点呼吸闪烁动画,忽隐忽现

设置自定义定位蓝点

自定义Marker标记点,呼吸闪烁的动画


效果图

贴出代码,学习高德地图官方demo

// 呼吸动画
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)));
}
// 动画执行完成后,默认会保持到最后一帧的状态
AnimationSet animationSet = new AnimationSet(true);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f, 0f);
alphaAnimation.setDuration(2000);
// 设置不断重复
alphaAnimation.setRepeatCount(Animation.INFINITE);
ScaleAnimation scaleAnimation = new ScaleAnimation(1, 3.5f, 1, 3.5f);
scaleAnimation.setDuration(2000);
// 设置不断重复
scaleAnimation.setRepeatCount(Animation.INFINITE);
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(scaleAnimation);
animationSet.setInterpolator(new LinearInterpolator());
breatheMarker.setAnimation(animationSet);
breatheMarker.startAnimation();
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
禁止转载,如需转载请通过简信或评论联系作者。