Example usage for android.view.animation ScaleAnimation setFillAfter

List of usage examples for android.view.animation ScaleAnimation setFillAfter

Introduction

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

Prototype

public void setFillAfter(boolean fillAfter) 

Source Link

Document

If fillAfter is true, the transformation that this animation performed will persist when it is finished.

Usage

From source file:Main.java

public static ScaleAnimation getScaleAnim(float fromScale, float toScale, long duration) {
    if (duration <= 0) {
        duration = DEFAULT_DURATION;//from   w w  w  .ja va2  s .c  om
    }
    ScaleAnimation anim = new ScaleAnimation(fromScale, toScale, fromScale, toScale, 0.5f, 0.5f);
    anim.setDuration(duration);
    anim.setFillAfter(true);
    return anim;
}

From source file:Main.java

public static Animation zoomAnimation(float startScale, float endScale, long duration) {
    ScaleAnimation anim = new ScaleAnimation(startScale, endScale, startScale, endScale,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    anim.setFillAfter(true);
    anim.setDuration(duration);/*w w w.j  a  v  a2  s .  c  o  m*/
    return anim;
}

From source file:Main.java

public static Animation createScaleAnimation(float fromXScale, float toXScale, float fromYScale, float toYScale,
        long duration) {
    ScaleAnimation anim = new ScaleAnimation(fromXScale, toXScale, fromYScale, toYScale,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    anim.setFillAfter(true);
    anim.setInterpolator(new AccelerateInterpolator());
    anim.setDuration(duration);/*from w w w .j a  va  2s .co m*/
    return anim;
}

From source file:Main.java

public static void toBigAnim2(View view) {
    ScaleAnimation animation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.0f);
    animation.setDuration(1000);/*www .  j  a v a2s.  co  m*/
    animation.setFillAfter(false);
    view.setAnimation(animation);
    animation.start();
}

From source file:Main.java

public static void updateAnimation(final View v) {
    final ScaleAnimation scaleInAnimation = new ScaleAnimation(v.getX(), v.getX() + 1, v.getY(), v.getY() + 1,
            v.getPivotX(), v.getPivotY());
    scaleInAnimation.setDuration(200);/*w ww  .  j  ava2  s  .  com*/
    scaleInAnimation.setFillAfter(false);
    v.startAnimation(scaleInAnimation);
}

From source file:Main.java

public static ScaleAnimation getScaleAnimation(float start, float end, int duration) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(start, end, start, end, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    scaleAnimation.setDuration(duration);
    scaleAnimation.setFillAfter(true);
    return scaleAnimation;
}

From source file:Main.java

public static ScaleAnimation getScaleAnimation(float ScaleFromX, float ScaleToX, float ScaleFromY,
        float ScaleToY, float pivotX, float pivotY, int intDuration, int intRepeatCount,
        boolean boolFillAfter) {
    ScaleAnimation mAnmation = new ScaleAnimation(ScaleFromX, ScaleToX, ScaleFromY, ScaleToY,
            Animation.RELATIVE_TO_SELF, pivotX, Animation.RELATIVE_TO_SELF, pivotY);
    mAnmation.setDuration(intDuration);//from  w  w  w .j  a v a2s .c o m
    mAnmation.setFillAfter(boolFillAfter);
    if (intRepeatCount != 1) {
        mAnmation.setRepeatMode(Animation.RESTART);
        mAnmation.setRepeatCount(intRepeatCount);
    }
    // translateAnimation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    return mAnmation;
}

From source file:Main.java

public static void setScaleAnimation(View view, float ScaleFromX, float ScaleToX, float ScaleFromY,
        float ScaleToY, float pivotX, float pivotY, int intDuration, int intRepeatCount,
        boolean boolFillAfter) {
    ScaleAnimation mAnmation = new ScaleAnimation(ScaleFromX, ScaleToX, ScaleFromY, ScaleToY,
            Animation.RELATIVE_TO_SELF, pivotX, Animation.RELATIVE_TO_SELF, pivotY);
    mAnmation.setDuration(intDuration);//from   w w  w  .  ja  v a2  s .  c  om
    mAnmation.setFillAfter(boolFillAfter);
    if (intRepeatCount != 1) {
        mAnmation.setRepeatMode(Animation.RESTART);
        mAnmation.setRepeatCount(intRepeatCount);
    }
    // translateAnimation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    view.startAnimation(mAnmation);
}

From source file:Main.java

public static AnimationSet RotateAndFadeInAnimation() {

    AlphaAnimation fade_in = new AlphaAnimation(0.2f, 1f);
    fade_in.setDuration(400);//from   w w  w.  ja  v  a  2s. 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 ww . ja  v a2 s .co  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;
}