List of usage examples for android.view.animation ScaleAnimation setDuration
public void setDuration(long durationMillis)
From source file:Main.java
public static ScaleAnimation getAmplificationAnimation(long durationMillis, AnimationListener animationListener) { ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF); scaleAnimation.setDuration(durationMillis); scaleAnimation.setAnimationListener(animationListener); return scaleAnimation; }
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);//from w w w . ja va2s .c o m anim.setDuration(duration); return anim; }
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 www. 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
/** * push View ScaleAnimation/*from w w w.j a v a 2 s . c o m*/ * * @param targetView TargetView * @param action MotionEventAction * @param scaleX * @param scaleY */ private static void pushScale(View targetView, int action, float scaleX, float scaleY) { if (action == MotionEvent.ACTION_DOWN) { // Touch Down ScaleAnimation anim = new ScaleAnimation(1.0f, scaleX, 1.0f, scaleY, targetView.getWidth() / 2, targetView.getHeight() / 2); anim.setDuration(DURATION); anim.setFillEnabled(true); anim.setFillAfter(true); targetView.startAnimation(anim); } else if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) { // Touch Up ScaleAnimation anim = new ScaleAnimation(scaleX, 1.0f, scaleY, 1.0f, targetView.getWidth() / 2, targetView.getHeight() / 2); anim.setDuration(DURATION); anim.setFillEnabled(true); anim.setFillAfter(true); targetView.startAnimation(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);/* ww w . ja v a2 s. c o m*/ anim.setInterpolator(new AccelerateInterpolator()); anim.setDuration(duration); return anim; }
From source file:Main.java
/** * Helps to show views./* w ww. j a v a 2 s. co m*/ * * @param views Views to show. * @param animationDuration Animation duration. * @param animationDelay Animation delay. */ static void orderedShowViews(final List<View> views, long animationDuration, int animationDelay) { if (views != null) { for (int viewIndex = 0; viewIndex < views.size(); viewIndex++) { final View childView = views.get(viewIndex); childView.setVisibility(View.VISIBLE); final ScaleAnimation scaleAnimation = new ScaleAnimation(0, childView.getScaleX(), 0, childView.getScaleY(), Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f); scaleAnimation.setInterpolator(new DecelerateInterpolator()); scaleAnimation.setDuration(animationDuration); scaleAnimation.setStartOffset(viewIndex * animationDelay); childView.startAnimation(scaleAnimation); } } }
From source file:Main.java
public static void scale(final View view, float fromScale, float toScale, long duration, final Runnable whenDone) { if (Build.VERSION.SDK_INT >= 12) { if (duration == 0) { view.setScaleX(toScale);// w w w . j a va 2 s .com view.setScaleY(toScale); if (whenDone != null) whenDone.run(); } else { ViewPropertyAnimator animation = view.animate().scaleX(toScale).scaleY(toScale) .setDuration(duration); if (whenDone != null) { animation.setListener(new AnimatorListener() { @Override public void onAnimationCancel(Animator animation) { whenDone.run(); } @Override public void onAnimationEnd(Animator animation) { whenDone.run(); } @Override public void onAnimationRepeat(Animator animation) { } @Override public void onAnimationStart(Animator animation) { } }); } animation.start(); } } else { ScaleAnimation scale = new ScaleAnimation(fromScale, toScale, fromScale, toScale, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scale.setDuration(duration); scale.setFillEnabled(true); scale.setFillBefore(true); scale.setFillAfter(true); if (whenDone != null) { scale.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { whenDone.run(); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationStart(Animation animation) { } }); } addAnimation(view, scale); } }
From source file:enterprayz.megatools.Tools.java
public static void replace(View source, int xTo, int yTo, float xScale, float yScale) { AnimationSet replaceAnimation = new AnimationSet(false); replaceAnimation.setFillAfter(true); ScaleAnimation scale = new ScaleAnimation(1.0f, xScale, 1.0f, yScale); scale.setDuration(1000); TranslateAnimation trans = new TranslateAnimation(0, 0, TranslateAnimation.ABSOLUTE, xTo - source.getLeft(), 0, 0, TranslateAnimation.ABSOLUTE, yTo - source.getTop()); trans.setDuration(1000);//from w w w. j av a2 s. com replaceAnimation.addAnimation(scale); replaceAnimation.addAnimation(trans); source.startAnimation(replaceAnimation); }
From source file:com.silentcircle.common.util.ViewUtil.java
public static void scaleToInvisible(View view) { ScaleAnimation animate = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animate.setDuration(100); animate.setFillAfter(true);/*from w w w . j a v a2 s.com*/ view.startAnimation(animate); view.setVisibility(View.GONE); }
From source file:com.silentcircle.common.util.ViewUtil.java
public static void scaleToVisible(View view) { ScaleAnimation animate = new ScaleAnimation(0.0f, 1.0f, 0.5f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animate.setDuration(100); animate.setFillAfter(true);/*from ww w .j a v a 2s . c o m*/ view.startAnimation(animate); view.setVisibility(View.VISIBLE); }