Example usage for android.view.animation Animation setStartOffset

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

Introduction

In this page you can find the example usage for android.view.animation Animation 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 fadeIn(View view, long duration, long delay) {
    Animation animation = new AlphaAnimation(0, 1);
    animation.setDuration(duration);/* ww  w .  j  a va  2  s  .  c o m*/
    animation.setStartOffset(delay);

    view.startAnimation(animation);
}

From source file:Main.java

public static Animation shakeAnimation(int X) {
    AnimationSet set = new AnimationSet(true);
    Animation anim1 = getTranslateAnimation(0, -200, 0, 0, 100);
    anim1.setStartOffset(100);
    set.addAnimation(anim1);/*www . j  a  va  2  s  .c  o m*/
    Animation anim2 = getTranslateAnimation(-200, 400, 0, 0, 200);
    anim2.setStartOffset(300);
    set.addAnimation(anim2);
    Animation anim3 = getTranslateAnimation(400, -200, 0, 0, 200);
    anim3.setStartOffset(500);
    set.addAnimation(anim3);
    Animation anim4 = getTranslateAnimation(-200, 0, 0, 0, 100);
    anim4.setStartOffset(600);
    set.addAnimation(anim4);
    set.setFillAfter(true);
    set.setDuration(640);
    return set;
}

From source file:Main.java

protected static void show(final View view) {
    Animation fadeIn = new AlphaAnimation(0, 1);
    fadeIn.setStartOffset(500);
    fadeIn.setDuration(500);// ww  w  .  ja v a  2  s  .  c om

    Animation collapse = new ScaleAnimation(1, 1, 0, 1);
    collapse.setDuration(500);

    AnimationSet animation = new AnimationSet(false);
    animation.setInterpolator(new AccelerateInterpolator());
    animation.addAnimation(collapse);
    animation.addAnimation(fadeIn);

    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            view.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            view.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    view.startAnimation(animation);
}

From source file:Main.java

private static void animation(View paramView, Animation paramAnimation, long paramLong1, long paramLong2) {
    paramAnimation.setDuration(paramLong1);
    paramAnimation.setStartOffset(paramLong2);
    paramView.setVisibility(0);//from w w w . j a  v  a2  s .c o  m
    paramView.startAnimation(paramAnimation);
}

From source file:Main.java

public static void blink(View view, int durationMs, int repeatCount) {
    Animation anim = new AlphaAnimation(1.0f, 0.0f);
    anim.setDuration(durationMs); //You can manage the time of the blink with this parameter
    anim.setStartOffset(0);
    anim.setRepeatMode(Animation.REVERSE);
    anim.setRepeatCount(repeatCount);/*from   w ww . j  a  va2s  .  c om*/
    view.startAnimation(anim);

}

From source file:Main.java

public static AnimationSet FlipAnimation(int duration, int repeatCount) {
    AnimationSet flip = new AnimationSet(true);
    if (duration > 20) //Flip anim
    {//from  w w  w. java2  s. co  m
        Animation from_middle1_anim = new ScaleAnimation(1.0f, 0.0f, 1.0f, 1.0f, Animation.RELATIVE_TO_SELF,
                .5f, Animation.RELATIVE_TO_SELF, .5f);
        from_middle1_anim.setDuration(duration);
        from_middle1_anim.setStartOffset(0);
        from_middle1_anim.setRepeatMode(Animation.REVERSE);
        from_middle1_anim.setRepeatCount(repeatCount);

        flip.addAnimation(from_middle1_anim);
    } else // no anim
    {
        Animation noAnim = new AlphaAnimation(1f, 1f);
        noAnim.setDuration(duration);
        flip.addAnimation(noAnim);
    }
    return flip;
}

From source file:com.capricorn.ArcMenu.java

private static Animation createHintSwitchAnimation(final boolean expanded) {
    Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF,
            0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setStartOffset(0);
    animation.setDuration(100);//from   w ww . j a  v  a2  s .com
    animation.setInterpolator(new DecelerateInterpolator());
    animation.setFillAfter(true);

    return animation;
}

From source file:com.capricorn.ArcMenu.java

private static Animation createQuickHintSwitchAnimation(final boolean expanded) {
    Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF,
            0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setStartOffset(0);
    animation.setDuration(10);//from   w w w .ja v a2  s. c o  m
    animation.setInterpolator(new DecelerateInterpolator());
    animation.setFillAfter(true);

    return animation;
}

From source file:de.uni_weimar.m18.anatomiederstadt.SplashActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    final PathView pathView = (PathView) findViewById(R.id.pathView);
    pathView.useNaturalColors();/*from  w  ww .java  2 s. com*/

    int pathDelay = 1000;
    int pathDuration = 2500;

    final Animation a = new AlphaAnimation(0.00f, 1.00f);
    a.setStartOffset(3500);
    a.setDuration(1000);

    //pathView.setSvgResource(R.raw.vitruvian_man_weimar_kk3);
    pathView.getPathAnimator().delay(pathDelay).duration(pathDuration)
            .interpolator(new AccelerateDecelerateInterpolator()).start();

    final ImageView logoImage = (ImageView) findViewById(R.id.logoImage);

    a.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            logoImage.setVisibility(View.VISIBLE);

            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    launchMainActivity();
                }
            }, 1500);

        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });

    logoImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            launchMainActivity();
        }
    });

    logoImage.startAnimation(a);

}

From source file:com.pepperonas.andbasx.animation.FadeAnimationColored.java

/**
 * Fade in./*  w ww .  ja  v  a 2s  . c  om*/
 */
public void fadeIn() {
    Animation anim = new AlphaAnimation(maxBrightness, minBrightness);
    anim.setDuration(duration);
    anim.setStartOffset(startOffset);
    anim.setFillEnabled(true);
    anim.setFillAfter(true);
    view.startAnimation(anim);
}