zoukankan      html  css  js  c++  java
  • android动画中Interpolater插入器

    Android 动画之Interpolator插入器
     
        ——AccelerateInterpolator:动画从开始到结束,变化率是一个加速的过程。
     
        ——DecelerateInterpolator:动画从开始到结束,变化率是一个减速的过程。
     
        ——CycleInterpolator:动画从开始到结束,变化率是循环给定次数的正弦曲线。
     
        ——AccelerateDecelerateInterpolator:动画从开始到结束,变化率是先加速后减速的过程。
     
        ——LinearInterpolator:动画从开始到结束,变化率是线性变化。
    AccelerateInterpolator有一个方法:getInterpolation(float input)
    源码:
    public float getInterpolation(float input) {
    61       if (mFactor == 1.0f) {
    62             return input * input;
    63         else {
    64             return (float)Math.pow(input, mDoubleFactor);
    65         }
    66     }
    Math.pow 的意思是 input 的 mDoubleFactor 次方,那么如果input不断变大的话, return  的数目就越来越大.而且是加速的.这样就成了加速动画.其他的其次类推.


    用处:比如你自己定义一个动画,用线程不断的刷新让一个东西旋转或者移动,你就可以用这个函数把输入的值变化一下再给真正处理动画刷新的函数,这样就可以看到加速和减速等效果.
  • 相关阅读:
    (二)、一步一步学GTK+之窗口
    phpcms v9 评论的bug.
    为discuz x2.5添加播放附件(mp4)的方法
    code::blocks + C + lua 编译环境
    C语言从声卡录音的一个demo
    泛型集合(.NET 2.0)
    VS2008对ASP.NET引用的外部JS文件不能调试
    for循环和foreach
    CSS之DIV上下左右居中
    GridView控件相关(来自互联网)
  • 原文地址:https://www.cnblogs.com/wangyuehome/p/2953040.html
Copyright © 2011-2022 走看看