Example usage for android.view.animation Animation setDuration

List of usage examples for android.view.animation Animation setDuration

Introduction

In this page you can find the example usage for android.view.animation Animation setDuration.

Prototype

public void setDuration(long durationMillis) 

Source Link

Document

How long this animation should last.

Usage

From source file:Main.java

public static Animation outToLeftAnimation() {
    Animation outtoLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    outtoLeft.setDuration(OUT_DURATION);
    outtoLeft.setInterpolator(new AccelerateInterpolator());
    return outtoLeft;
}

From source file:Main.java

public static Animation outToRightAnimation() {
    Animation outtoRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    outtoRight.setDuration(OUT_DURATION);
    outtoRight.setInterpolator(new AccelerateInterpolator());
    return outtoRight;
}

From source file:Main.java

public static Animation inFromLeftAnimation() {
    Animation inFromLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    inFromLeft.setDuration(DURATION);
    inFromLeft.setInterpolator(new AccelerateDecelerateInterpolator());
    return inFromLeft;
}

From source file:Main.java

public static Animation createShowTranslateAnimationOnX() {
    final Animation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            0.0f);/*from  www .jav  a 2s .  c  o  m*/
    animation.setDuration(1500);
    return animation;
}

From source file:Main.java

public static void slideToUp(View view) {
    Animation slide = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f);

    slide.setDuration(400);
    slide.setFillAfter(true);//  w  w  w  . j  av a  2  s  . c o m
    slide.setFillEnabled(true);
    view.startAnimation(slide);

    slide.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {

        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

}

From source file:Main.java

public static Animation inFromRightAnimation() {

    Animation inFromRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, +1.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    inFromRight.setDuration(DURATION);
    inFromRight.setInterpolator(new AccelerateDecelerateInterpolator());
    return inFromRight;
}

From source file:Main.java

public static Animation outToTopAnimation() {
    Animation outToTop = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, -1.0f);
    outToTop.setDuration(350);
    outToTop.setInterpolator(new AccelerateInterpolator());
    return outToTop;
}

From source file:Main.java

public static Animation getFadeOutAnimation(int durationInMilliseconds) {
    Animation fadeOut = new AlphaAnimation(1, 0);
    fadeOut.setFillAfter(true);// w ww  . j ava  2s .  co  m
    fadeOut.setInterpolator(new AccelerateInterpolator());
    fadeOut.setDuration(durationInMilliseconds);
    return fadeOut;
}

From source file:Main.java

public static Animation inFromTopAnimation() {

    Animation inFromTop = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    inFromTop.setDuration(350);
    inFromTop.setInterpolator(new AccelerateInterpolator());
    return inFromTop;
}

From source file:Main.java

public static Animation outToBottomAnimation() {
    Animation outToBottom = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, +1.0f);
    outToBottom.setDuration(350);
    outToBottom.setInterpolator(new AccelerateInterpolator());
    return outToBottom;
}