Android中的动画

主要分为

{

逐帧动画 和  补间动画  

}

逐帧动画的用法:

      <animation-list xmlns:android="http://schemas.android.com/apk/res/android"
         android:oneshot="true|false">

            

            //oneshot:是否循环播放

            //duration:动画持续的时间

            <item android:drawable="@drawable/图片资源名1" android:duration="integer" />
            <!-- 省略了部分<item></item>标记 -->
            <item android:drawable="@drawable/图片资源名n" android:duration="integer" />
     </animation-list>

补间动画的用法:

  1.透明度渐变动画

  2.旋转动画

  3.缩放动画

  4.平移动画

   1.透明度渐变动画

{

    <set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@[package:]anim/interpolator_resource">

    //repeatMode:动画的方向{反向或者重置}

    //repeatCount:动画的重复次数

    //duration:动画的持续时间

    //fromAlpha:动画开始时的透明度{1.不透明,0:完全透明}

    //toAlpha:动画结束时的透明度{1.不透明,0:完全透明}
    <alpha
      android:repeatMode="reverse|restart"
      android:repeatCount="次数|infinite"
      android:duration="Integer"
      android:fromAlpha="float"
      android:toAlpha="float" />
    </set>

}

 

2.旋转动画

{

    <set xmlns:android="http://schemas.android.com/apk/res/android"
      android:interpolator="@[package:]anim/interpolator_resource">

      //fromDegrees:动画开始的旋转的角度

      //toDegrees:动画结束的旋转的角度

      //pivotX:动画开始中心点的横坐标

      //pivotY:动画开始中心点的横坐标

      //repeatMode:动画的方向{反向或者重置}

      //repeatCount:动画的重复次数

      //duration:动画的持续时间


      <rotate
        android:fromDegrees="float"
        android:toDegrees="float"
        android:pivotX="float"
        android:pivotY="float"
        android:repeatMode="reverse|restart"
        android:repeatCount="次数|infinite"
        android:duration="Integer"/>
    </set>

 

}

 

3.缩放动画

{

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@[package:]anim/interpolator_resource">

//fromXScale:动画开始时的横坐标

//fromYScale:动画开始时的纵坐标

//toXScale:动画结束时的横坐标

//toYScale:动画结束时的纵坐标

//pivotX:动画开始中心点的横坐标

//pivotY:动画开始中心点的横坐标

//repeatMode:动画的方向{反向或者重置}

//repeatCount:动画的重复次数

//duration:动画的持续时间


<scale
  android:fromXScale="float"
  android:toXScale="float"
  android:fromYScale="float"
  android:toYScale="float"
  android:pivotX="float"
  android:pivotY="float"
  android:repeatMode="reverse|restart"
  android:repeatCount="次数|infinite"
  android:duration="Integer"/>
</set>

}

 

posted @ 2018-03-25 20:30  安琪儿。流苏  阅读(49)  评论(0)    收藏  举报