show Up And Down Bounce ObjectAnimator - Android android.animation

Android examples for android.animation:ObjectAnimator

Description

show Up And Down Bounce ObjectAnimator

Demo Code


//package com.java2s;
import android.animation.Animator;

import android.animation.ObjectAnimator;

import android.view.View;

import android.view.animation.OvershootInterpolator;

public class Main {

    public static Animator showUpAndDownBounce(View view, int translationY,
            int animatorTime, boolean isStartAnimator,
            boolean isStartInterpolator) {
        ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view,
                "translationY", translationY);
        if (isStartInterpolator) {
            objectAnimator.setInterpolator(new OvershootInterpolator());
        }// w w w .  j  a  va  2 s . c o  m
        objectAnimator.setDuration(animatorTime);
        if (isStartAnimator) {
            objectAnimator.start();
        }
        return objectAnimator;
    }
}

Related Tutorials