安卓属性动画

public void btn_alpha(View v){//渐变
    ObjectAnimator animator=ObjectAnimator.ofFloat(iv,"alpha",0f,1f);
    animator.setDuration(1000);
    animator.setRepeatCount(1);
    animator.setRepeatMode(ValueAnimator.RESTART);
    animator.start();
}
public void btn_robot(View v){//旋转

    ObjectAnimator animator=ObjectAnimator.ofFloat(iv,"rotation",0f,360f);
    animator.setDuration(1000);
    animator.setRepeatCount(1);
    animator.setRepeatMode(ValueAnimator.RESTART);
    animator.start();
}
public void btn_tran(View v){//偏移

    ObjectAnimator animator=ObjectAnimator.ofFloat(iv,"translationX",0,360);
    animator.setDuration(1000);
    animator.setRepeatCount(1);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.start();
}
public void btn_suo(View v){//缩放
    ObjectAnimator animator=ObjectAnimator.ofFloat(iv,"scaleX",1f,0.5f);
    animator.setDuration(1000);
    animator.setRepeatCount(1);
    animator.setRepeatMode(ValueAnimator.RESTART);
    animator.start();
}
public void btn_set(View v){//集合
    ObjectAnimator animator1=ObjectAnimator.ofFloat(iv,"scaleX",1f,0.5f);
    ObjectAnimator animator2=ObjectAnimator.ofFloat(iv,"translationX",0,360);
    ObjectAnimator animator=ObjectAnimator.ofFloat(iv,"rotation",0f,360f);
    AnimatorSet set=new AnimatorSet();
    //在旋转之后 after rotation
    set.play(animator1).with(animator2).before(animator);
    set.setDuration(2000);
    set.start();
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值