Example usage for android.view View startAnimation

List of usage examples for android.view View startAnimation

Introduction

In this page you can find the example usage for android.view View startAnimation.

Prototype

public void startAnimation(Animation animation) 

Source Link

Document

Start the specified animation now.

Usage

From source file:Main.java

public static void disappear(long during, View view) {
    AlphaAnimation disappearAnimation = new AlphaAnimation(1, 0);
    disappearAnimation.setDuration(during);
    disappearAnimation.setFillAfter(true);
    view.startAnimation(disappearAnimation);
}

From source file:Main.java

public static void animSlideOutFromTop(final View view) {
    TranslateAnimation animate = new TranslateAnimation(0, 0, 0, view.getHeight());
    animate.setDuration(400);/*  w ww .j  a v a2 s . c o m*/
    animate.setFillAfter(true);
    view.startAnimation(animate);
    view.setVisibility(View.GONE);
}

From source file:Main.java

public static void animSlideOutFromBottom(final View view) {
    TranslateAnimation animate = new TranslateAnimation(0, 0, 0, -view.getHeight());
    animate.setDuration(500);//from w  ww .  j av a 2s .c  om
    animate.setFillAfter(true);
    view.startAnimation(animate);
    view.setVisibility(View.GONE);
}

From source file:Main.java

public static void fadeIn(View view, long duration, long delay) {
    Animation animation = new AlphaAnimation(0, 1);
    animation.setDuration(duration);//from w w w  . java 2  s  . co  m
    animation.setStartOffset(delay);

    view.startAnimation(animation);
}

From source file:Main.java

/**
 * Animates a view sliding in from the left
 * @param view//w  w w  .ja  v  a 2 s.c o m
 */
public static void slideInLeft(final View view, int duration) {
    final Animation inLeft = new TranslateAnimation(view.getX() - view.getWidth(), 0, 0, view.getX());
    inLeft.setDuration(duration);
    view.startAnimation(inLeft);
}

From source file:Main.java

public static void btnScaleSelf(View view) {
    ScaleAnimation sa = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5F,
            Animation.RELATIVE_TO_SELF, 0.5F);
    sa.setDuration(1000);/*from  ww  w.  j  a  v  a  2s  . c  o  m*/
    view.startAnimation(sa);
}

From source file:Main.java

public static Animation makeInvisibleAnimated(final View view) {
    final Animation a = new AlphaAnimation(1.00f, 0.00f);
    a.setDuration(500);//from   w  ww.j a va  2s.c  o m
    a.setAnimationListener(getFadeOutListener(view));

    view.startAnimation(a);

    return a;
}

From source file:Main.java

@SuppressLint("NewApi")
public static Animation makeVisibleAnimated(final View view) {
    final Animation a = new AlphaAnimation(0.00f, 1.00f);
    a.setDuration(500);/*from  ww w. j a v  a 2s . c  om*/
    a.setAnimationListener(getFadeInListener(view));

    view.startAnimation(a);

    return a;
}

From source file:Main.java

public static void btnRotateSelf(View view) {
    RotateAnimation ra = new RotateAnimation(0, 360, RotateAnimation.RELATIVE_TO_SELF, 0.5F,
            RotateAnimation.RELATIVE_TO_SELF, 0.5F);
    ra.setDuration(1000);// w  w w.ja v a  2  s . com
    view.startAnimation(ra);
}

From source file:Main.java

public static void SetImageSlide(View v, int startX, int toX, int startY, int toY) {
    TranslateAnimation anim = new TranslateAnimation(startX, toX, startY, toY);
    anim.setDuration(200);/*  www .  j  a  v  a  2 s  .com*/
    anim.setFillAfter(true);
    v.startAnimation(anim);
}