Example usage for android.view.animation AlphaAnimation AlphaAnimation

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

Introduction

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

Prototype

public AlphaAnimation(float fromAlpha, float toAlpha) 

Source Link

Document

Constructor to use when building an AlphaAnimation from code

Usage

From source file:Main.java

public static Animation fadeIn() {
    Animation fadein = new AlphaAnimation(0.0f, +1.0f);
    fadein.setDuration(DURATION);/*  w  w  w  .  jav a 2 s  .c om*/
    fadein.setInterpolator(new DecelerateInterpolator()); // start quickly...
    return fadein;
}

From source file:Main.java

public static Animation fadeOut() {
    Animation fadeout = new AlphaAnimation(+1.0f, 0.0f);
    fadeout.setDuration(DURATION);//from  www .  j a  va  2 s . co m
    fadeout.setInterpolator(new AccelerateInterpolator());
    return fadeout;
}

From source file:Main.java

public static void alphaAnimation(View v, float fromAlpha, float toAlpha, long durationMillis,
        boolean fillAfter) {
    AlphaAnimation animation = new AlphaAnimation(fromAlpha, toAlpha);
    animation.setDuration(durationMillis);
    animation.setFillAfter(fillAfter);/*from  ww w  .j a  va 2s . com*/
    animation.setRepeatMode(Animation.REVERSE);
    v.startAnimation(animation);
}

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 w w  .j  a  v a  2  s . c om*/
    a.setAnimationListener(getFadeOutListener(view));

    view.startAnimation(a);

    return a;
}

From source file:Main.java

/**
 * Fades in the view/*www.j a  v a 2s  .  c o  m*/
 * @param view
 */
public static void fadeIn(final View view, int duration) {
    final Animation in = new AlphaAnimation(0.0f, 1.0f);
    in.setDuration(duration);
    view.setAnimation(in);
}

From source file:Main.java

public static void fadeToVisible(final View view, int startOffset, int duration) {
    int visibility = view.getVisibility();
    if (visibility != View.VISIBLE) {
        AlphaAnimation anim = new AlphaAnimation(0, 1);
        anim.setDuration(duration);//from w  w w.  j  a  v  a2s. com
        anim.setStartOffset(startOffset);
        view.setVisibility(View.VISIBLE);
        view.startAnimation(anim);
    }
}

From source file:Main.java

public static void fadeToInvisible(final View view, int startOffset, int duration) {
    int visibility = view.getVisibility();
    if (visibility != View.INVISIBLE) {
        AlphaAnimation anim = new AlphaAnimation(1, 0);
        anim.setStartOffset(startOffset);
        anim.setDuration(duration);//from  w w w .j  a  v  a 2 s.  com
        view.setVisibility(View.INVISIBLE);
        view.startAnimation(anim);
    }
}

From source file:Main.java

public static Animation fadeIn(final android.view.animation.Animation.AnimationListener animationlistener) {
    final AlphaAnimation alphaanimation = new AlphaAnimation(0F, 1F);
    alphaanimation.setDuration(300L);//from  w  ww  .  jav a 2  s  . c  o m
    alphaanimation.setInterpolator(new LinearInterpolator());
    alphaanimation.setAnimationListener(animationlistener);
    return alphaanimation;
}

From source file:Main.java

public static Animation fadeOut(final android.view.animation.Animation.AnimationListener animationlistener) {
    final AlphaAnimation alphaanimation = new AlphaAnimation(1F, 0F);
    alphaanimation.setDuration(300L);// ww  w  .  j ava 2 s . c  o  m
    alphaanimation.setInterpolator(new LinearInterpolator());
    alphaanimation.setAnimationListener(animationlistener);
    return alphaanimation;
}

From source file:Main.java

public static Animation fadeInLong(final android.view.animation.Animation.AnimationListener animationlistener) {
    final AlphaAnimation alphaanimation = new AlphaAnimation(0F, 1F);
    alphaanimation.setDuration(600L);/* w w  w .java2s .  c o m*/
    alphaanimation.setInterpolator(new LinearInterpolator());
    alphaanimation.setAnimationListener(animationlistener);
    return alphaanimation;
}