android--(动画1_动画补间动画和帧动画)

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

//透明方式
        //代码方式
        Animation alphaAnimation = new AlphaAnimation(0.0f,1.0f);

//
//
//        //加载 动画资源文件
//        Animation animation = AnimationUtils.loadAnimation(this, R.anim.alpha_anim);
//
//        ImageView iv = (ImageView) view;
//
//        //启动动画
//        iv.startAnimation(animation);


aplha_ain.xml:
 <alpha
        android:duration="3000"
        android:fromAlpha="1.0"
        android:toAlpha="0.0"/>
//scale 缩放方式
    public void click(View view) {


        Animation animation = AnimationUtils.loadAnimation(this, R.anim.scale_anim);

        ImageView iv = (ImageView) view;

        iv.startAnimation(animation);
    }

//scale_anim.xml
   <scale
        android:duration="3000"
        android:fillAfter="false"

        android:fromXScale="0.0"
        android:fromYScale="0.0"

        android:pivotX="50%"
        android:pivotY="50%"

        android:toXScale="1.0"
        android:toYScale="1.0"

        />
//平移方式
    public void click(View view) {
        Animation animation = AnimationUtils.loadAnimation(this, R.anim.translate_anim);

        ImageView iv = (ImageView) view;

        iv.startAnimation(animation);
    }
 <translate

        android:duration="3000"
        android:fromXDelta="0"

        android:fromYDelta="0"

        android:toXDelta="300" //移动的像素
        android:toYDelta="300"


        />
//旋转的方式 
    public void click(View view) {

        Animation animation = AnimationUtils.loadAnimation(this, R.anim.rotate_anim);

        ImageView iv = (ImageView) view;

        iv.startAnimation(animation);
    }

   <rotate

        android:duration="3000"

        android:fromDegrees="0"

        android:pivotX="50%"

        android:pivotY="50%"
        android:toDegrees="360" //正数,则正转,负数,逆转
        />
//帧动画
    public void click(View view) {

        AnimationDrawable ad = (AnimationDrawable) imageView.getDrawable();

        ad.start();//启动

        //ad.stop();停止
    }


<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true">//为true表示循环一次

    <item
        android:drawable="@mipmap/a"
        android:duration="3000"/>//多长时间播放下一个
    <item
        android:drawable="@mipmap/b"
        android:duration="3000"/>
    <item
        android:drawable="@mipmap/c"
        android:duration="3000"/>


</animation-list>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值