List of usage examples for android.view.animation ScaleAnimation setDuration
public void setDuration(long durationMillis)
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); return scale; }
From source file:Main.java
public static Animation getScaleAnimation(float scaleXY, long durationMillis) { ScaleAnimation scale = new ScaleAnimation(1.0f, scaleXY, 1.0f, scaleXY, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scale.setDuration(durationMillis); return scale; }
From source file:Main.java
public static void shrinkToLeft(FragmentActivity activity, View view, AnimationListener listener) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int screenHeight = displaymetrics.heightPixels; int screenWidth = displaymetrics.widthPixels; AnimationSet animation = new AnimationSet(true); float pivotX = view.getWidth() / 2; float pivotY = view.getHeight() / 2; ScaleAnimation anim = new ScaleAnimation(1f, 0.8f, 1f, 0.8f, pivotX, pivotY); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(200); anim.setStartOffset(200);/*from w w w . j a va 2s .c o m*/ //anim.setFillAfter(true); animation.addAnimation(anim); TranslateAnimation animTrans = new TranslateAnimation(0.0f, (float) -(screenWidth - view.getWidth()), 0.0f, 0.0f); anim.setInterpolator(new LinearInterpolator()); animTrans.setDuration(400); //animTrans.setStartOffset(300); animation.addAnimation(animTrans); if (listener != null) animation.setAnimationListener(listener); view.startAnimation(animation); }
From source file:Main.java
public static void enlargeToRight(FragmentActivity activity, View view, AnimationListener listener) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int screenHeight = displaymetrics.heightPixels; int screenWidth = displaymetrics.widthPixels; AnimationSet animation = new AnimationSet(true); float pivotX = view.getWidth() / 2; float pivotY = view.getHeight() / 2; ScaleAnimation anim = new ScaleAnimation(0.8f, 1f, 0.8f, 1f, pivotX, pivotY); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(200); anim.setStartOffset(200);//from w ww. j a v a 2s . c om //anim.setFillAfter(true); animation.addAnimation(anim); TranslateAnimation animTrans = new TranslateAnimation(0.0f, (float) (screenWidth - view.getWidth()), 0.0f, 0.0f); anim.setInterpolator(new LinearInterpolator()); animTrans.setDuration(400); //animTrans.setStartOffset(300); animation.addAnimation(animTrans); if (listener != null) animation.setAnimationListener(listener); view.startAnimation(animation); }
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 . j a 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 void setOnTouchScaleAnimation(View targetView, final float scaleX, final float scaleY) { targetView.setOnTouchListener(new View.OnTouchListener() { @Override/*from w w w . j ava2 s.c o m*/ public boolean onTouch(View v, MotionEvent event) { final int action = event.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: { ScaleAnimation anim = new ScaleAnimation(1.0f, scaleX, 1.0f, scaleY, v.getWidth() / 2, v.getHeight() / 2); anim.setDuration(60); anim.setFillEnabled(true); anim.setFillAfter(true); v.startAnimation(anim); break; } case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: { ScaleAnimation anim = new ScaleAnimation(scaleX, 1.0f, scaleY, 1.0f, v.getWidth() / 2, v.getHeight() / 2); anim.setDuration(100); v.startAnimation(anim); break; } } return false; } }); }
From source file:Main.java
public static AnimationSet RotateAndFadeOutAnimation() { AlphaAnimation fade_out = new AlphaAnimation(1f, 0.2f); fade_out.setDuration(500);//from ww w . ja va 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
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); mAnmation.setFillAfter(boolFillAfter); if (intRepeatCount != 1) { mAnmation.setRepeatMode(Animation.RESTART); mAnmation.setRepeatCount(intRepeatCount); }//from www. j av a 2 s . com // 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); mAnmation.setFillAfter(boolFillAfter); if (intRepeatCount != 1) { mAnmation.setRepeatMode(Animation.RESTART); mAnmation.setRepeatCount(intRepeatCount); }/*from ww w . jav a 2 s . c o m*/ // translateAnimation.setInterpolator(AnimationUtils.loadInterpolator(mContext, // com.webclient.R.anim.bounce_interpolator)); view.startAnimation(mAnmation); }
From source file:Main.java
public static ScaleAnimation getLessenScaleAnimation(long durationMillis, AnimationListener animationListener) { ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF); scaleAnimation.setDuration(durationMillis); scaleAnimation.setAnimationListener(animationListener); return scaleAnimation; }