Example usage for android.view.animation AlphaAnimation setStartOffset

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

Introduction

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

Prototype

public void setStartOffset(long startOffset) 

Source Link

Document

When this animation should start relative to the start time.

Usage

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  ww  .  ja  v a2 s  . co  m*/
        view.setVisibility(View.INVISIBLE);
        view.startAnimation(anim);
    }
}

From source file:Main.java

public static AnimationSet flash(final android.view.animation.Animation.AnimationListener animationlistener) {
    final AnimationSet animationset = new AnimationSet(true);
    final AlphaAnimation alphaanimation = new AlphaAnimation(0F, 1F);
    alphaanimation.setStartOffset(500L);
    alphaanimation.setDuration(100L);/*from  ww w.j  a v a2s. c o  m*/
    animationset.addAnimation(alphaanimation);
    final AlphaAnimation alphaanimation1 = new AlphaAnimation(1F, 0F);
    alphaanimation1.setDuration(100L);
    alphaanimation1.setStartOffset(1200L);
    animationset.addAnimation(alphaanimation1);
    animationset.setAnimationListener(animationlistener);
    return animationset;
}

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  ww w  .j  a  va2 s. co m
        anim.setStartOffset(startOffset);
        view.setVisibility(View.VISIBLE);
        view.startAnimation(anim);
    }
}

From source file:Main.java

public static AnimationSet RotateAndFadeInAnimation() {

    AlphaAnimation fade_in = new AlphaAnimation(0.2f, 1f);
    fade_in.setDuration(400);/*  w  ww. j  a v  a  2 s  . c o  m*/
    fade_in.setStartOffset(0);
    fade_in.setFillAfter(true);

    ScaleAnimation expand = new ScaleAnimation(0.2f, 1, 0.2f, 1, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    expand.setDuration(500);
    expand.setStartOffset(0);
    expand.setFillAfter(true);

    RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    rotate.setDuration(500);
    rotate.setStartOffset(0);
    // rotate.setInterpolator(new LinearInterpolator());
    rotate.setFillAfter(true);

    AnimationSet Reload = new AnimationSet(true);
    Reload.addAnimation(fade_in);
    Reload.addAnimation(expand);
    Reload.addAnimation(rotate);
    Reload.setInterpolator(new DecelerateInterpolator(1.3f));
    return Reload;
}

From source file:Main.java

public static AnimationSet RotateAndFadeOutAnimation() {
    AlphaAnimation fade_out = new AlphaAnimation(1f, 0.2f);
    fade_out.setDuration(500);/*from w  w w  .  ja  v a  2s  .c  o m*/
    fade_out.setStartOffset(0);
    fade_out.setFillAfter(true);

    ScaleAnimation shrink = new ScaleAnimation(1f, 0.2f, 1f, 0.2f, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    shrink.setDuration(400);
    shrink.setStartOffset(0);
    shrink.setFillAfter(true);

    RotateAnimation rotate = new RotateAnimation(0.0f, 360f, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    rotate.setDuration(500);
    rotate.setStartOffset(0);
    rotate.setInterpolator(new LinearInterpolator());
    rotate.setFillAfter(true);

    AnimationSet Reload = new AnimationSet(true);
    Reload.addAnimation(fade_out);
    Reload.addAnimation(shrink);
    Reload.addAnimation(rotate);
    Reload.setInterpolator(new AccelerateInterpolator(1.1f));

    return Reload;
}

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 w w  .java2s . com*/
}

From source file:quickbeer.android.next.views.ProgressIndicatorBar.java

private void animateToHidden() {
    Log.v(TAG, "animateToHidden()");

    AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
    animation.setStartOffset(ANIMATION_END_PAUSE_DURATION);
    animation.setDuration(ANIMATION_END_FADE_DURATION);
    animation.setFillAfter(true);//from w ww. j a v  a 2s  .  c  o m

    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:quickbeer.android.views.ProgressIndicatorBar.java

private void animateToHidden() {
    Timber.v("animateToHidden()");
    checkNotNull(progressBar);/*from  www. j  ava2 s .  c o m*/

    AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
    animation.setStartOffset(ANIMATION_END_PAUSE_DURATION);
    animation.setDuration(ANIMATION_END_FADE_DURATION);
    animation.setFillAfter(true);

    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:com.cachirulop.moneybox.fragment.MoneyboxFragment.java

/**
 * Create dynamically an android animation for a coin or a bill deleted from
 * the moneybox./*w  w  w.ja  v a  2 s . co  m*/
 * 
 * @param img
 *            ImageView to receive the animation
 * @param layout
 *            Layout that paint the image
 * @return Set of animations to apply to the image
 */
private AnimationSet createDeleteAnimation(ImageView img, View layout) {
    AnimationSet result;

    result = new AnimationSet(false);
    result.setFillAfter(true);

    // Fade out
    AlphaAnimation fadeOut;

    fadeOut = new AlphaAnimation(1.0f, 0.0f);
    fadeOut.setStartOffset(300);
    fadeOut.setDuration(300);

    result.addAnimation(fadeOut);

    return result;
}

From source file:com.cachirulop.moneybox.fragment.MoneyboxFragment.java

/**
 * Create dynamically an android animation for a coin or a bill getting from
 * the moneybox./*from w  w w.  j a v a2  s.  co  m*/
 * 
 * @param img
 *            ImageView to receive the animation
 * @param layout
 *            Layout that paint the image
 * @return Set of animations to apply to the image
 */
private AnimationSet createGetAnimation(ImageView img, View layout) {
    AnimationSet result;

    result = new AnimationSet(false);
    result.setFillAfter(true);

    // get
    TranslateAnimation get;
    int bottom;

    bottom = Math.abs(layout.getHeight() - img.getLayoutParams().height);
    get = new TranslateAnimation(1.0f, 1.0f, bottom, 1.0f);
    get.setDuration(1500);
    result.addAnimation(get);

    // Fade out
    AlphaAnimation fadeOut;

    fadeOut = new AlphaAnimation(1.0f, 0.0f);
    fadeOut.setDuration(300);
    fadeOut.setStartOffset(1500);

    result.addAnimation(fadeOut);

    return result;
}