Code example for ObjectAnimator

Methods: setDuration, setInterpolator, start

0
    /** 
     * Anticipate the future animation by rearing back, away from the direction of travel 
     */ 
    private void runPressAnim() { 
        downAnim = ObjectAnimator.ofFloat(this, "skewX", mOnLeft ? .5f : -.5f);
        downAnim.setDuration(2500);
        downAnim.setInterpolator(sDecelerator);
        downAnim.start();
    } 
 
    /** 
     * Finish the "anticipation" animation (skew the button back from the direction of 
     * travel), animate it to the other side of the screen, then un-skew the button 
     * with an Overshoot effect. 
     */ 
    private void runClickAnim() { 
        // Anticipation 
        ObjectAnimator finishDownAnim = null;
        if (downAnim != null && downAnim.isRunning()) {
            // finish the skew animation quickly 
            downAnim.cancel();