List of usage examples for android.view.animation ScaleAnimation ScaleAnimation
public ScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)
From source file:Main.java
public static AnimationSet startInfoAnimation(int AnimationType, float fromX, float toX, float fromY, float toY, float scaleX, float scaleToX, float scaleY, float scaleToY, float pinX, float pinY) { OvershootInterpolator overshootInterpolator = new OvershootInterpolator(2f); 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);/* w ww .ja va2s .c om*/ animationSet.addAnimation(translateAnimation); animationSet.addAnimation(scaleAnimation); animationSet.setDuration(300); animationSet.setFillAfter(true); animationSet.setInterpolator(overshootInterpolator); return animationSet; }
From source file:Main.java
/** * Helps to show views.//from w w w . j a va 2s . c om * * @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 startScaleAnimationOn(View view, float startScale, float endScale, long duration) { Animation anim = new ScaleAnimation(1f, 1f, startScale, endScale, Animation.ABSOLUTE, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setDuration(duration);/*w w w .j ava2 s . c om*/ anim.setFillAfter(true); view.startAnimation(anim); }
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);/*from ww w. j a v a2 s . co m*/ return scale; }
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);// ww w . j a v a 2s.c om 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:net.evendanan.pushingpixels.PassengerFragmentSupport.java
@Nullable public static Animation onCreateAnimation(@NonNull Fragment passengerFragment, int transit, boolean enter, int nextAnim) { Log.d(TAG, "onCreateAnimation: transit: " + transit + ", enter: " + enter + ", nextAnim: " + nextAnim); final boolean validTransitionToModify = nextAnim == R.anim.ui_context_expand_add_in || nextAnim == R.anim.ui_context_expand_pop_out; if (!validTransitionToModify) return null; ScaleAnimation scale = null;// w w w . ja v a2 s.co m PointF originateViewCenterPoint = PointFCompat.getPointFromBundle(passengerFragment.getArguments(), EXTRA_ORIGINATE_VIEW_CENTER); PointF originateViewScale = PointFCompat.getPointFromBundle(passengerFragment.getArguments(), EXTRA_ORIGINATE_VIEW_SCALE); if (originateViewCenterPoint != null && originateViewScale != null) { Log.d(TAG, "originateViewCenterPoint: " + originateViewCenterPoint.toString()); if (enter && nextAnim == R.anim.ui_context_expand_add_in) { scale = new ScaleAnimation(originateViewScale.x, 1.0f, originateViewScale.y, 1.0f, ScaleAnimation.ABSOLUTE, originateViewCenterPoint.x, ScaleAnimation.ABSOLUTE, originateViewCenterPoint.y); } else if (!enter && nextAnim == R.anim.ui_context_expand_pop_out) { scale = new ScaleAnimation(1.0f, originateViewScale.x, 1.0f, originateViewScale.y, ScaleAnimation.ABSOLUTE, originateViewCenterPoint.x, ScaleAnimation.ABSOLUTE, originateViewCenterPoint.y); } } if (scale == null) { //no originate view, so I'll add generic scale-animation if (enter) { scale = new ScaleAnimation(0.4f, 1.0f, 0.4f, 1.0f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f); } else { scale = new ScaleAnimation(1.0f, 0.4f, 1.0f, 0.4f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f); } } scale.setDuration(passengerFragment.getResources().getInteger(android.R.integer.config_mediumAnimTime)); AnimationSet set = (AnimationSet) AnimationUtils .loadAnimation(passengerFragment.getActivity().getApplicationContext(), nextAnim); set.addAnimation(scale); return set; }
From source file:com.example.android.google.wearable.watchviewstub.MainActivity.java
/** * Animates the layout when clicked. The animation used depends on whether the * device is round or rectangular./*from w ww . j av a 2s .c o m*/ */ public void onLayoutClicked(View view) { if (mRectBackground != null) { ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.7f, 1.0f, 0.7f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setDuration(300); scaleAnimation.setRepeatCount(1); scaleAnimation.setRepeatMode(Animation.REVERSE); mRectBackground.startAnimation(scaleAnimation); } if (mRoundBackground != null) { mRoundBackground.animate().rotationBy(360).setDuration(300).start(); } }
From source file:zjut.soft.finalwork.fragment.RightFragment.java
public void plannerScaleAction() { ScaleAnimation scaleanim1 = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleanim1.setDuration(1500);/*from w w w. jav a 2s .com*/ scaleanim1.setFillAfter(true); scaleanim1.setRepeatCount(Animation.INFINITE); scaleanim1.setRepeatMode(Animation.REVERSE); scaleanim1.setInterpolator(new AccelerateDecelerateInterpolator()); plannerIV.setAnimation(scaleanim1); scaleanim1.startNow(); }
From source file:com.tompee.funtablayout.PopTabView.java
public void scaleView(View v, float startScale, float endScale) { mAnimation = new ScaleAnimation(startScale, endScale, startScale, endScale, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mAnimation.setFillAfter(true);// w w w . j ava 2 s .c o m mAnimation.setDuration(mAnimationDuration); v.startAnimation(mAnimation); }
From source file:com.mindorks.framework.mvp.ui.main.MainActivity.java
@Override public void reloadQuestionnaire(List<Question> questionList) { refreshQuestionnaire(questionList);//w w w . j a v a2s . c o m ScaleAnimation animation = new ScaleAnimation(1.15f, 1, 1.15f, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mCardsContainerView.setAnimation(animation); animation.setDuration(100); animation.start(); }