美文网首页
基础动画2017.8.4

基础动画2017.8.4

作者: Sunny君907 | 来源:发表于2018-03-19 10:26 被阅读0次

 透明度动画   

        android:duration="1000"

        android:fromAlpha="0.0"

        android:toAlpha="1.0"

        />

  /**

    *第一个参数fromAlpha为动画开始时候透明度

    *第二个参数toAlpha为动画结束时候透明度

    */

    Animation animation = new AlphaAnimation(0, 1);

    animation.setDuration(1000);

   v.startAnimation(animation);

    缩放动画

encoding="utf-8"?>

xmlns:android="http://schemas.android.com/apk/res/android">

       android:duration="1000"

       android:fromXScale="0"

       android:fromYScale="0"

       android:pivotX="50%"

       android:pivotY="50%"

       android:toXScale="1"

       android:toYScale="1" />

 /**

 *第一个参数fromX为动画起始时 X坐标上的伸缩尺寸

 *第二个参数toX为动画结束时 X坐标上的伸缩尺寸

 *第三个参数fromY为动画起始时Y坐标上的伸缩尺寸

 *第四个参数toY为动画结束时Y坐标上的伸缩尺寸

 *说明: 0.0表示收缩到没有;1.0表示正常无伸缩;值小于1.0表示收缩;值大于1.

 *第五个参数pivotXType为动画在X轴相对于物件位置类型

 *第六个参数pivotXValue为动画相对于物件的X坐标的开始位置

 *第七个参数pivotXType为动画在Y轴相对于物件位置类型

 *第八个参数pivotYValue为动画相对于物件的Y坐标的开始位置

 */

Animation animation = new ScaleAnimation(0,

1

animation.setDuration(1000);

iv.startAnimation(animation);

    旋转动画

encoding="utf-8"?>

xmlns:android="http://schemas.android.com/apk/res/android">

       android:duration="1000"

       android:fromDegrees="0"

       android:pivotX="50%"

       android:pivotY="50%"

       android:toDegrees="360" />

   /**

    *第一个参数fromDegrees为动画起始时角度

    *第二个参数toDegrees为动画结束角度

    *第三个参数pivotXType为动画在X轴相对于物件位置类型

    *第四个参数pivotXValue为动画相对于物件的X坐标的开始位置

    *第五个参数pivotXType为动画在Y轴相对于物件位置类型

    *第六个参数pivotYValue为动画相对于物件的Y坐标的开始位置

    */

   Animation animation = new RotateAnima

   animation.setDuration(1000);

   iv.startAnimation(animation);

    位移动画

encoding="utf-8"?>

xmlns:android="http://schemas.android.com/apk/res/android">

       android:duration="2000"

       android:fromXDelta="0"

       android:fromYDelta="0"

       android:toXDelta="500"

       android:interpolator="@android:anim/accelerate_interpolator"

       android:toYDelta="0" />

   /**

    *第一个参数fromDegrees为动画起始时角度

    *第二个参数toDegrees为动画结束角度

    *第三个参数pivotXType为动画在X轴相对于物件位置类型

    *第四个参数pivotXValue为动画相对于物件的X坐标的开始位置

    *第五个参数pivotXType为动画在Y轴相对于物件位置类型

    *第六个参数pivotYValue为动画相对于物件的Y坐标的开始位置

    */

    Animation animation = new RotateAnima

    animation.setDuration(1000);

    iv.startAnimation(animation);

    /**

     *第一个参数fromXDelta为动画起始时的x坐标

     *第二个参数toXDelta为动画结束时的x坐标

     *第三个参数fromYDelta为动画起始时的y坐标

     *第四个参数toYDelta为动画结束时的y坐标

     */

     Animation animation = new Translat

     animation.setDuration(2000);

     /**设置插值器:先加速,后减速**/

     animation.setInterpolator(new Acce

     iv.startAnimation(animation);

相关文章

网友评论

      本文标题:基础动画2017.8.4

      本文链接:https://www.haomeiwen.com/subject/elpuqftx.html