android Animation

AlphaAnimation 透明度动画效果 
ScaleAnimation 缩放动画效果 
TranslateAnimation 位移动画效果 
RotateAnimation 旋转动画效果 

public static void startAnimationsIn(ViewGroup viewgroup,int durationMillis) {

for (int i = 0; i < viewgroup.getChildCount(); i++) {
ImageButton inoutimagebutton = (ImageButton) viewgroup
.getChildAt(i);
inoutimagebutton.setVisibility(0);
MarginLayoutParams mlp = (MarginLayoutParams) inoutimagebutton.getLayoutParams();
Animation animation = new TranslateAnimation(mlp.rightMargin-xOffset,0F,yOffset + mlp.bottomMargin, 0F);
// 这个是我们最常用的一个构造方法,
// float fromXDelta:这个参数表示动画开始的点离当前View X坐标上的差值;
// float toXDelta, 这个参数表示动画结束的点离当前View X坐标上的差值;
// float fromYDelta, 这个参数表示动画开始的点离当前View Y坐标上的差值;
// float toYDelta)这个参数表示动画开始的点离当前View Y坐标上的差值;
//   如果view在A(x,y)点 那么动画就是从B点(x+fromXDelta, y+fromYDelta)点移动到C 点(x+toXDelta,y+toYDelta)点.
//停留最后效果
animation.setFillAfter(true);
//动画时间毫秒数
animation.setDuration(durationMillis);
//设置对话偏移量
animation.setStartOffset((i * 100)
/ (-1 + viewgroup.getChildCount()));
animation.setInterpolator(new OvershootInterpolator(2F));
inoutimagebutton.startAnimation(animation);

}

}


public static Animation getRotateAnimation(float fromDegrees ,float toDegrees,int durationMillis){
RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setDuration(durationMillis);
rotate.setFillAfter(true);
return rotate;
}


本节讲解RotateAnimation 动画, 
RotateAnimation (float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue) 
参数说明: 
float fromDegrees:旋转的开始角度。 
float toDegrees:旋转的结束角度。 
int pivotXType:X轴的伸缩模式,可以取值为ABSOLUTE、RELATIVE_TO_SELF、RELATIVE_TO_PARENT。 
float pivotXValue:X坐标的伸缩值。 
int pivotYType:Y轴的伸缩模式,可以取值为ABSOLUTE、RELATIVE_TO_SELF、RELATIVE_TO_PARENT。 
float pivotYValue:Y坐标的伸缩值。 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值