zoukankan      html  css  js  c++  java
  • TranslateAnimation详解

    TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta);

    从(fromXDelta,fromYDelta)坐标点移动到(toXDelta,toYDelta)坐标点。这些坐标点指的是增量坐标。

    如:当前View在(10,10)坐标点。
      1.TranslateAnimation(0,10,0,10);即为以当前点为起始点偏移x=10,y=10的距离。
    效果为当前View从自己的位置移动到了自己位置下方的(10,10)点

      2.TranslateAnimation(10,20,10,20);即为以起始点(当前x+10,当前y+10),移动到终点(当前x+20,当前y+20)。
    效果为当前View跳跃到相对于当前位置的(10,10)点,移动到了相对于当前位置的(20,20)点
            
    明白增量坐标的意思了吧




    TranslateAnimation(int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue)
     移动的坐标还是增量坐标。

     Type分为Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT
    说明Value如何解释。
     当为Animation.ABSOLUTE,为绝对位置。如10,既为相对于当前位置增量为10的坐标点
     当为Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT为百分比(0-1.0)。
    如:
    fromXType=Animation.RELATIVE_TO_SELF
    fromXValue=0
    意思为按自身的宽高来算Value,x=宽*value;y=高*value
    fromXValue=0相当于Animation.ABSOLUTE下的0
    fromXValue=0.5相当于Animation.ABSOLUTE下的宽*value为值
    fromXValue=1.0相当于Animation.ABSOLUTE下的View宽度为值


    new TranslateAnimation(
                    Animation.RELATIVE_TO_SELF, 0.5f,
                    Animation.ABSOLUTE, 10,
                    Animation.RELATIVE_TO_SELF, 0.5f,
                    Animation.ABSOLUTE, 10);
    设View的宽为100,高为50

    就是从(100*0.5,50*0.5)的增量点移动到(10,10)增量点
    明白了吧。我是明白了。我也是边写demo边理解。有错误要指教哦,亲

  • 相关阅读:
    风讯DotNetCMS sp5安装笔记
    datalist中实现自动编号写法
    windows server 2008 自动登录设置
    C#软件监控外部程序运行状态
    WPF启动屏幕SplashScreen
    Windows Server 2019 在桌面上显示“我的电脑”
    使用jquery的load方法加载html页面,html引入的js无效
    sql查询文章上一篇下一篇
    C#调用user32.dll Win32的API函数
    C#调用dll提示"试图加载格式不正确的程序
  • 原文地址:https://www.cnblogs.com/beenupper/p/2589956.html
Copyright © 2011-2022 走看看