Example usage for android.view.animation TranslateAnimation TranslateAnimation

List of usage examples for android.view.animation TranslateAnimation TranslateAnimation

Introduction

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

Prototype

public TranslateAnimation(int fromXType, float fromXValue, int toXType, float toXValue, int fromYType,
        float fromYValue, int toYType, float toYValue) 

Source Link

Document

Constructor to use when building a TranslateAnimation from code

Usage

From source file:Main.java

public static TranslateAnimation moveToViewBottom() {
    TranslateAnimation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            5.0f);/*from  w w w  .  ja  v  a  2 s . c o m*/
    mHiddenAction.setDuration(2500);
    return mHiddenAction;
}

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(500);/*w  w  w.  jav  a  2s.c  o  m*/
    inFromRight.setInterpolator(new AccelerateInterpolator());
    return inFromRight;
}

From source file:Main.java

public static TranslateAnimation moveToViewBottom() {
    TranslateAnimation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            1.0f);// www  .  java 2s. c  o  m
    mHiddenAction.setDuration(200);
    return mHiddenAction;
}

From source file:Main.java

public static TranslateAnimation moveToViewLocation() {
    TranslateAnimation mHiddenAction = 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);/*from  ww w.  j  a va  2s . c o  m*/
    mHiddenAction.setDuration(200);
    return mHiddenAction;
}

From source file:Main.java

public static TranslateAnimation moveToViewLocation() {
    TranslateAnimation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 5.0f, Animation.RELATIVE_TO_SELF,
            0.0f);//from  w  ww.jav  a  2  s  . c  o m
    mHiddenAction.setDuration(1500);
    return mHiddenAction;
}

From source file:Main.java

private static TranslateAnimation trans(int fromXType, int fromXValue, int toXType, int toXValue, int fromYType,
        int fromYValue, int toYType, int toYValue) {
    TranslateAnimation anima = new TranslateAnimation(fromXType, fromXValue, toXType, toXValue, fromYType,
            fromYValue, toYType, toYValue);
    anima.setDuration(500);/* w  w  w  .java2  s .  com*/
    return anima;

}

From source file:Main.java

public static Animation slideOutAnimation() {
    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(500);//from   ww w.jav a2s .c  o m
    outtoRight.setInterpolator(new AccelerateDecelerateInterpolator());
    return outtoRight;
}

From source file:Main.java

public static Animation slideInAnimation() {

    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(500);/*from  w  w  w  .j  a v  a2  s .co  m*/
    inFromRight.setInterpolator(new AccelerateDecelerateInterpolator());
    return inFromRight;
}

From source file:Main.java

private static TranslateAnimation getTranslateX100To0Animation(View view, long duration) {
    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1,
            Animation.RELATIVE_TO_SELF, 0, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0);
    animation.setDuration(duration);//  www . j  a  v  a2  s .  c o  m
    return animation;
}

From source file:Main.java

private static TranslateAnimation getTranslateX0To100Animation(View view, long duration) {
    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0,
            Animation.RELATIVE_TO_SELF, 1, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0);
    animation.setDuration(duration);//from  ww w.j ava 2  s  . com
    return animation;
}