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 outAlphaAnimation() {
    AlphaAnimation alpha = new AlphaAnimation(1.0f, 0.0f);
    alpha.setDuration(1000);//from   w w w .ja v a  2 s.c om
    alpha.setInterpolator(new AccelerateInterpolator());
    return alpha;
}

From source file:Main.java

public static void setAlphaInAnimation(final View v, final int duration) {
    Animation animation = new AlphaAnimation(0, 1);
    animation.setDuration(duration);/*from  w w  w  .j  a  v  a  2 s.  c om*/
    animation.setRepeatCount(0);
    v.startAnimation(animation);
}

From source file:Main.java

public static void startAlphaAnim(View view, float from, float to, long duration) {
    Animation anim = new AlphaAnimation(from, to);
    anim.setDuration(duration);/*from w  ww  .j ava2s .co  m*/
    anim.setFillAfter(true);
    view.startAnimation(anim);
}

From source file:Main.java

public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, int intDuration,
        boolean boolFillAfter) {
    AlphaAnimation mAnmation = new AlphaAnimation(fromAlpha, toAlpha);
    mAnmation.setDuration(intDuration);/*from  w w w.j  a va2  s . co m*/
    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 setAnimListView(ListView listView) {
    AlphaAnimation animation = new AlphaAnimation(0, 1f);
    animation.setDuration(4000);/*from   w  w w .  j a  v a  2  s  .com*/
    LayoutAnimationController controller = new LayoutAnimationController(animation, 0.5f);
    listView.setLayoutAnimation(controller);
}

From source file:Main.java

public static Animation getFadeInAnimation(int duration) {
    Animation fadeIn = new AlphaAnimation(0, 1);
    fadeIn.setInterpolator(new DecelerateInterpolator()); //add this
    fadeIn.setDuration(duration);//from w ww. j  a  v  a 2  s.c  om

    return fadeIn;
}

From source file:Main.java

public static AlphaAnimation getAlphaAnimation(Float fromAlpha, Float endAlpha, long durationMillis) {
    AlphaAnimation inAlphaAnimation = new AlphaAnimation(fromAlpha, endAlpha);
    inAlphaAnimation.setDuration(durationMillis);
    return inAlphaAnimation;
}

From source file:Main.java

public static void animateView(View view) {
    final Animation animation = new AlphaAnimation(1f, 0f);
    animation.setDuration(1000); // Animate for 1 seconds
    animation.setInterpolator(new LinearInterpolator());
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.REVERSE);
    view.startAnimation(animation);//from ww w  . j a  va2 s. c  o m
}

From source file:Main.java

public static Animation getFadeOutAnimation(int durationInMilliseconds) {
    final Animation fadeOut = new AlphaAnimation(1, 0);
    fadeOut.setFillAfter(true);//w w  w  .j a  v a  2 s  .c  o m
    fadeOut.setInterpolator(new AccelerateInterpolator());
    fadeOut.setDuration(durationInMilliseconds);
    return fadeOut;
}

From source file:Main.java

public static void animaBotao(Button botao) {
    final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
    animation.setDuration(400);//w  w  w.  j av a2 s . co  m
    animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
    animation.setRepeatCount(2);
    animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in
    botao.startAnimation(animation);
}