Example usage for android.view.animation ScaleAnimation ScaleAnimation

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

Introduction

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

Prototype

public ScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType, float pivotXValue,
        int pivotYType, float pivotYValue) 

Source Link

Document

Constructor to use when building a ScaleAnimation from code

Usage

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  a 2  s  . 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 animationScale(View paramView) {
    animation(paramView, new ScaleAnimation(0.0F, 1.0F, 0.0F, 1.0F, 2, 0.5F, 2, 0.5F), 1000L, 0L);
}

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 . j  a  va  2s .  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 FlipAnimation(int duration, int repeatCount) {
    AnimationSet flip = new AnimationSet(true);
    if (duration > 20) //Flip anim
    {/*from  w ww. j  ava  2s  .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:Main.java

public static AnimationSet RotateAndFadeInAnimation() {

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

From source file:Main.java

private static void scaleDownAni(View v) {
    /*if(scaleDownAni == null){
       scaleDownAni = new ScaleAnimation(1.0f, SCALE_DOWN_VALUE, 1.0f, SCALE_DOWN_VALUE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
       scaleDownAni.setDuration(SCALE_ANI_DURATION);
       scaleDownAni.setFillAfter(true);/*from w ww.j  av  a 2  s  . c o m*/
    }*/

    ScaleAnimation scaleDownAni = new ScaleAnimation(1.0f, SCALE_DOWN_VALUE, 1.0f, SCALE_DOWN_VALUE,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    scaleDownAni.setDuration(SCALE_ANI_DURATION);
    scaleDownAni.setFillAfter(true);

    //v.startAnimation(scaleDownAni);
    //v.setAnimation(scaleDownAni);
    //scaleDownAni.startNow();
    v.startAnimation(scaleDownAni);

    /*v.animate().scaleX(SCALE_DOWN_VALUE);
    v.animate().scaleY(SCALE_DOWN_VALUE);
    v.animate().setDuration(SCALE_ANI_DURATION);
    v.animate().start();*/

    //v.setScaleX(SCALE_DOWN_VALUE);
    //v.setScaleY(SCALE_DOWN_VALUE);
}

From source file:Main.java

public static void animationScale(View paramView, long paramLong,
        Animation.AnimationListener paramAnimationListener) {
    ScaleAnimation localScaleAnimation = new ScaleAnimation(0.0F, 1.0F, 0.0F, 1.0F, 1, 0.5F, 1, 0.5F);
    localScaleAnimation.setAnimationListener(paramAnimationListener);
    animation(paramView, localScaleAnimation, paramLong, 0L);
}

From source file:Main.java

public static AnimationSet setExitAnimation(int AnimationType, float fromX, float toX, float fromY, float toY,
        float scaleX, float scaleToX, float scaleY, float scaleToY, float pinX, float pinY) {
    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateAnimation = new TranslateAnimation(AnimationType, fromX, AnimationType, toX,
            AnimationType, fromY, AnimationType, toY);
    ScaleAnimation scaleAnimation = new ScaleAnimation(scaleX, scaleToX, scaleY, scaleToY, AnimationType, pinX,
            AnimationType, pinY);/*ww  w .j  a  va 2  s  . c  o  m*/
    animationSet.addAnimation(translateAnimation);
    animationSet.addAnimation(scaleAnimation);
    animationSet.setDuration(300);
    return animationSet;
}

From source file:Main.java

public static Animation getScaleAnimation(long durationMillis) {
    ScaleAnimation scale = new ScaleAnimation(1.0f, 1.5f, 1.0f, 1.5f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    scale.setDuration(durationMillis);// www. j  a  v  a  2  s.  com
    return scale;
}