Example usage for android.view.animation AlphaAnimation setDuration

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

Introduction

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

Prototype

public void setDuration(long durationMillis) 

Source Link

Document

How long this animation should last.

Usage

From source file:Main.java

public static void appear(long during, View view) {
    AlphaAnimation appearAnimation = new AlphaAnimation(0, 1);
    appearAnimation.setDuration(during);
    view.startAnimation(appearAnimation);
}

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);
        anim.setStartOffset(startOffset);
        view.setVisibility(View.VISIBLE);
        view.startAnimation(anim);//  ww w. java 2  s  . c o m
    }
}

From source file:Main.java

public static void fadeIn(View view, int durationMillis) {
    if (view != null) {
        AlphaAnimation fadeImage = new AlphaAnimation(0, 1);
        fadeImage.setDuration(durationMillis);
        fadeImage.setInterpolator(new DecelerateInterpolator());
        view.startAnimation(fadeImage);// w w  w  . j a v  a 2 s. co  m
    }
}

From source file:Main.java

public static Animation createAlphaAnimation(float fromAlpha, float toAlpha, long duration) {
    AlphaAnimation anim = new AlphaAnimation(fromAlpha, toAlpha);
    anim.setDuration(duration);
    anim.setInterpolator(new AccelerateInterpolator());
    return anim;//from   w  w  w .  j a  va 2 s.  c  o  m
}

From source file:Main.java

public static AlphaAnimation getInAlphaAnimation(long durationMillis) {
    AlphaAnimation inAlphaAnimation = new AlphaAnimation(0, 1);
    inAlphaAnimation.setDuration(durationMillis);
    return inAlphaAnimation;
}

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 AlphaAnimation getOutAlphaAnimation(long durationMillis) {
    AlphaAnimation outAlphaAnimation = new AlphaAnimation(1, 0);
    outAlphaAnimation.setDuration(durationMillis);
    return outAlphaAnimation;
}

From source file:Main.java

public static void animate(View v, int duration) {
    AlphaAnimation alpha = new AlphaAnimation(0f, 1f);
    alpha.setDuration(duration);
    v.startAnimation(alpha);//from w ww.  j a  v  a 2  s  . c  o m
}

From source file:Main.java

public static Animation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis) {
    AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
    alpha.setDuration(durationMillis);
    alpha.setFillAfter(true);//from w w  w.j  a  v  a 2 s  .co m
    return alpha;
}

From source file:Main.java

public static void setAlphaAnimation(View v, int time, int repeatCount, int startOffset) {
    AlphaAnimation myAnimation_Alpha = new AlphaAnimation(0f, 1.0f);
    myAnimation_Alpha.setDuration(time);
    myAnimation_Alpha.setRepeatCount(repeatCount);
    myAnimation_Alpha.setStartOffset(startOffset);
    v.setAnimation(myAnimation_Alpha);/*from   w  ww.  j  av  a 2 s.co m*/
}