Example usage for android.view.animation Animation RELATIVE_TO_SELF

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

Introduction

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

Prototype

int RELATIVE_TO_SELF

To view the source code for android.view.animation Animation RELATIVE_TO_SELF.

Click Source Link

Document

The specified dimension holds a float and should be multiplied by the height or width of the object being animated.

Usage

From source file:Main.java

public static Animation hideToLeft() {
    Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
    mShowAction.setDuration(TIME);//from ww w.j a v  a 2  s  . c o m
    return mShowAction;
}

From source file:Main.java

public static Animation hideToRight() {
    Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            -1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
    mShowAction.setDuration(TIME);//ww  w .  ja  v  a2s .  co  m
    return mShowAction;
}

From source file:Main.java

public static Animation showAnimation() {
    Animation mShowAction = 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);
    mShowAction.setDuration(TIME);//from   ww  w.  j  av  a2  s .  c  o m
    return mShowAction;
}

From source file:Main.java

public static Animation hideAnimation() {
    Animation 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);//from   w ww .  ja  v  a  2s.  c  o  m
    mHiddenAction.setDuration(TIME);
    return mHiddenAction;
}

From source file:Main.java

public static Animation getRotateAnimation(float from, float to, int duration) {
    RotateAnimation animation = new RotateAnimation(from, to, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(duration);/*from   w  ww  .ja va 2s . c  o m*/
    animation.setFillAfter(true);
    return animation;
}

From source file:Main.java

public static void toBigAnim2(View view) {
    ScaleAnimation animation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.0f);
    animation.setDuration(1000);/*  ww  w .  ja v  a  2 s.  com*/
    animation.setFillAfter(false);
    view.setAnimation(animation);
    animation.start();
}

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);//from w  w  w . j a v  a  2 s  .  c o  m
    slide.setFillAfter(true);
    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 rotationAnimation() {
    final RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setDuration(600);/*from   w  ww .j a v a2s . c  o  m*/
    rotate.setRepeatMode(Animation.RESTART);
    rotate.setRepeatCount(Animation.INFINITE);
    return rotate;

}

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);/*  w  w w.  j  a  v a 2s .com*/
    mHiddenAction.setDuration(2500);
    return mHiddenAction;
}

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);//from  ww w . j av a 2  s  .com
    mHiddenAction.setDuration(200);
    return mHiddenAction;
}