目录
4.2.5 SingleScaleAnimation(X或Y方向单独缩放动画类)
1. Animation
1.1 Animation简介
BaiduMap的动画类Animation,还有6个子类:AlphaAnimation, AnimationSet, RotateAnimation, ScaleAnimation,
SingleScaleAnimation, Transformation;
1.2 动画的函数
abstract void | cancel() 取消 Marker 动画 |
abstract void | setAnimationListener(Animation.AnimationListener animationListener) 设置 Marker 动画监听 |
abstract void | setDuration(long duration) 设置 Marker 动画执行时间 |
abstract void | setInterpolator(Interpolator interpolator) 设置 Marker 动画插值器 |
2 AnimationListener
BaiduMap提供的动画监听,提供了4个函数:onAnimationStart()、onAnimationEnd()、onAnimationCancel()、
onAnimationRepeat();
3 Animation.RepeatMode
BaiduMap提供的RepeatMode重复类型类有两个常量:REVERSE(反向)和RESTART(重新开始);
4 Animation子类
4.1 AnimationSet类
AnimationSet是动画集合,继承了Animation类并实现了函数,另外有自己的2个函数:
void | addAnimation(Animation animation) 向 Marker 动画集合中添加动画 |
void | setAnimatorSetMode(int combinationMode) 设置 Marker 集合动画播放模式 0:组合播放 1:顺序播放 |
4.2 其他子类
4.2.1 子类函数
1. public void setRepeatMode(Animation.RepeatMode repeatMode)
设置 Marker 动画重复模式
参数:
repeatMode - 默认为 RepeatMode.RESTART
2. public void setRepeatCount(int repeatCount)
设置 Marker 动画重复次数
参数:
repeatCount - 默认为0
4.2.2 AlphaAnimation(透明)
public AlphaAnimation(float... alpha)
4.2.3 RotateAnimation(旋转)
public RotateAnimation(float fromDegrees, float toDegrees)
4.2.4 ScaleAnimation(缩放)
public ScaleAnimation(float... scale)
4.2.5 SingleScaleAnimation(X或Y方向单独缩放动画类)
构造函数:
public SingleScaleAnimation(SingleScaleAnimation.ScaleType scaleType, float... scale)
SingleScaleAnimation.ScaleType有两个常量:SCALE_Y和SCALE_X
4.2.6 Transformation(平移动画)
构造函数1:public Transformation(LatLng... values)
构造函数2:public Transformation(Point... values)
5 动画案例
动画案例参考:BaiduMap SDK-Marker动画案例