Example usage for android.view.animation Animation RELATIVE_TO_PARENT

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

Introduction

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

Prototype

int RELATIVE_TO_PARENT

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

Click Source Link

Document

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

Usage

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);/*  w  w  w . j av  a  2 s  .  c om*/
    inFromLeft.setInterpolator(new AccelerateDecelerateInterpolator());
    return inFromLeft;
}

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);/*  w  w w.  j ava 2  s.  c o  m*/
    inFromRight.setInterpolator(new AccelerateDecelerateInterpolator());
    return inFromRight;
}

From source file:Main.java

public static TranslateAnimation getTranslateAnimationToParent(float pivotFromX, float pivotToX,
        float pivotFromY, float pivotToY, int intDuration, boolean boolFillAfter) {
    TranslateAnimation mAnmation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, pivotFromX,
            Animation.RELATIVE_TO_PARENT, pivotToX, Animation.RELATIVE_TO_PARENT, pivotFromY,
            Animation.RELATIVE_TO_PARENT, pivotToY);
    mAnmation.setDuration(intDuration);/*from  www  . ja v a  2  s . c  om*/
    mAnmation.setFillAfter(boolFillAfter);
    // mAnmation.setRepeatMode(Animation.RESTART);
    // mAnmation.setRepeatCount(intRepeatCount);
    // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    return mAnmation;
}

From source file:Main.java

public static void setTranslateAnimationToParent(View view, float pivotFromX, float pivotToX, float pivotFromY,
        float pivotToY, int intDuration, boolean boolFillAfter) {
    TranslateAnimation mAnmation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, pivotFromX,
            Animation.RELATIVE_TO_PARENT, pivotToX, Animation.RELATIVE_TO_PARENT, pivotFromY,
            Animation.RELATIVE_TO_PARENT, pivotToY);
    mAnmation.setDuration(intDuration);//from  ww w.  ja v a2  s  . c  o m
    mAnmation.setFillAfter(boolFillAfter);
    // mAnmation.setRepeatMode(Animation.RESTART);
    // mAnmation.setRepeatCount(intRepeatCount);
    // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    view.startAnimation(mAnmation);
}

From source file:Main.java

private static void ApplyHorizontalScrollAnimation(View view, boolean left, int speed) {
    float sign = left ? 1f : -1f;
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.setRepeatCount(Animation.INFINITE);
    animationSet.setRepeatMode(Animation.RESTART);

    TranslateAnimation move = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, sign * 0.70f,
            Animation.RELATIVE_TO_PARENT, sign * -0.70f, Animation.RELATIVE_TO_PARENT, 0,
            Animation.RELATIVE_TO_PARENT, 0);
    move.setStartOffset(0);/* w w  w. ja  v  a2  s.co  m*/
    move.setDuration(speed);
    move.setFillAfter(true);
    animationSet.addAnimation(move);
    view.startAnimation(animationSet);
}

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);//from   w w  w. j  a va2s.c  o m
    outToTop.setInterpolator(new AccelerateInterpolator());
    return outToTop;
}

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);/*from w w  w. ja  v  a  2 s. com*/
    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);//from w w w . java2s . com
    outToBottom.setInterpolator(new AccelerateInterpolator());
    return outToBottom;
}

From source file:Main.java

public static Animation inFromBottomAnimation() {
    Animation inFromBottom = 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);
    inFromBottom.setDuration(350);//from   w w w  . j  a va  2  s  .  c  o m
    inFromBottom.setInterpolator(new AccelerateInterpolator());
    return inFromBottom;
}