android 属性动画 介绍

来源:互联网 发布:双十一淘宝销售额2016 编辑:程序博客网 时间:2024/06/16 02:05
先看一个位移动画 
ObjectAnimator anim = ObjectAnimator.ofFloat(view, "translationY", 500f);anim.setDuration(0);// 正式开始启动执行动画anim.start();

translationY 或者 translationX 沿着垂直或者水平方向移动

第三个参数是不定参数 view将依次移动到指定的位置

  /**     * Constructs and returns an ObjectAnimator that animates between float values. A single     * value implies that that value is the one being animated to. Two values imply a starting     * and ending values. More than two values imply a starting value, values to animate through     * along the way, and an ending value (these values will be distributed evenly across     * the duration of the animation).     *     * @param target The object whose property is to be animated. This object should     * have a public method on it called <code>setName()</code>, where <code>name</code> is     * the value of the <code>propertyName</code> parameter.     * @param propertyName The name of the property being animated.     * @param values A set of values that the animation will animate between over time.     * @return An ObjectAnimator object that is set up to animate between the given values.     */    public static ObjectAnimator ofFloat(Object target, String propertyName, float... values) {

propertyName 还会有 scaleX scaleY  等属性值
0 0
原创粉丝点击