Here are the examples of the java api class android.view.animation.ScaleAnimation taken from open source projects.
1. DynamicRotationGuideView#playCenter()
Project: AndroidStudyDemo
File: DynamicRotationGuideView.java
File: DynamicRotationGuideView.java
/** * ???View???? */ private void playCenter() { AnimationSet animationSet = new AnimationSet(false); ScaleAnimation scaleSmall = new ScaleAnimation(1.0f, 0.6f, 1.0f, 0.6f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); ScaleAnimation scaleBig = new ScaleAnimation(1.0f, 5.0f / 3, 1.0f, 5.0f / 3, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleBig.setDuration(2 * 1000); scaleBig.setInterpolator(interpolator); scaleSmall.setDuration(2 * 1000); scaleSmall.setStartOffset(2 * 1000); scaleSmall.setRepeatCount(-1); scaleSmall.setFillEnabled(true); scaleSmall.setFillAfter(true); scaleBig.setStartOffset(2 * 1000); scaleBig.setRepeatCount(-1); scaleBig.setFillEnabled(true); scaleBig.setFillAfter(true); scaleSmall.setInterpolator(interpolator); animationSet.addAnimation(scaleBig); animationSet.addAnimation(scaleSmall); center.startAnimation(animationSet); }
2. Selector#animateScale()
Project: tomahawk-android
File: Selector.java
File: Selector.java
private void animateScale(View view, boolean reverse, Animation.AnimationListener listener) { ScaleAnimation animation; if (reverse) { animation = new ScaleAnimation(1f, 0.5f, 1f, 0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0f); } else { animation = new ScaleAnimation(0.5f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0f); } animation.setDuration(120); view.startAnimation(animation); animation.setFillAfter(true); animation.setAnimationListener(listener); }
3. SquashPageAnimator#initAnimations()
Project: Paginize
File: SquashPageAnimator.java
File: SquashPageAnimator.java
private void initAnimations() { DecelerateInterpolator interpolator = new DecelerateInterpolator(3.0f); mExpandInFromRightAnimation = new ScaleAnimation(0, 1, 1, 1, Animation.RELATIVE_TO_PARENT, 1, Animation.RELATIVE_TO_PARENT, 0); mExpandInFromRightAnimation.setInterpolator(interpolator); mExpandInFromRightAnimation.setDuration(ANIMATION_DURATION); mShrinkOutFromRightAnimation = new ScaleAnimation(1, 0, 1, 1, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0); mShrinkOutFromRightAnimation.setInterpolator(interpolator); mShrinkOutFromRightAnimation.setDuration(ANIMATION_DURATION); mExpanndInFromLeftAnimation = new ScaleAnimation(0, 1, 1, 1, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0); mExpanndInFromLeftAnimation.setInterpolator(interpolator); mExpanndInFromLeftAnimation.setDuration(ANIMATION_DURATION); mShrinkOutFromLeftAnimation = new ScaleAnimation(1, 0, 1, 1, Animation.RELATIVE_TO_PARENT, 1, Animation.RELATIVE_TO_PARENT, 0); mShrinkOutFromLeftAnimation.setInterpolator(interpolator); mShrinkOutFromLeftAnimation.setDuration(ANIMATION_DURATION); }
4. Utils#createScaleAnimation()
Project: android-open-project-demo
File: Utils.java
File: Utils.java
public static Animation createScaleAnimation(View view, int parentWidth, int parentHeight, int toX, int toY) { // Difference in X and Y final int diffX = toX - view.getLeft(); final int diffY = toY - view.getTop(); // Calculate actual distance using pythagors float diffDistance = FloatMath.sqrt((toX * toX) + (toY * toY)); float parentDistance = FloatMath.sqrt((parentWidth * parentWidth) + (parentHeight * parentHeight)); ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 0f, 1f, 0f, Animation.ABSOLUTE, diffX, Animation.ABSOLUTE, diffY); scaleAnimation.setFillAfter(true); scaleAnimation.setInterpolator(new DecelerateInterpolator()); scaleAnimation.setDuration(Math.round(diffDistance / parentDistance * Constants.SCALE_ANIMATION_DURATION_FULL_DISTANCE)); return scaleAnimation; }
5. ViewUtils#elevateView()
Project: actor-platform
File: ViewUtils.java
File: ViewUtils.java
public static void elevateView(final View view, boolean isAnimated, float scale) { if (view == null) { return; } ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, scale, 1.0f, scale, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5); scaleAnimation.setDuration(isAnimated ? 150 : 0); scaleAnimation.setInterpolator(MaterialInterpolator.getInstance()); scaleAnimation.setFillAfter(true); view.clearAnimation(); view.startAnimation(scaleAnimation); }
6. SampleCallout#transitionIn()
Project: TileView
File: SampleCallout.java
File: SampleCallout.java
public void transitionIn() { ScaleAnimation scaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 1f); scaleAnimation.setInterpolator(new OvershootInterpolator(1.2f)); scaleAnimation.setDuration(250); AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1f); alphaAnimation.setDuration(200); AnimationSet animationSet = new AnimationSet(false); animationSet.addAnimation(scaleAnimation); animationSet.addAnimation(alphaAnimation); startAnimation(animationSet); }
7. ZoomOutImageDisplayer#display()
Project: Sketch
File: ZoomOutImageDisplayer.java
File: ZoomOutImageDisplayer.java
@Override public void display(ImageViewInterface imageViewInterface, Drawable newDrawable) { if (newDrawable == null) { return; } ScaleAnimation scaleAnimation = new ScaleAnimation(fromX, 1.0f, fromY, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setInterpolator(interpolator); scaleAnimation.setDuration(duration); imageViewInterface.clearAnimation(); imageViewInterface.setImageDrawable(newDrawable); imageViewInterface.startAnimation(scaleAnimation); }
8. ZoomInImageDisplayer#display()
Project: Sketch
File: ZoomInImageDisplayer.java
File: ZoomInImageDisplayer.java
@Override public void display(ImageViewInterface imageViewInterface, Drawable newDrawable) { if (newDrawable == null) { return; } ScaleAnimation scaleAnimation = new ScaleAnimation(fromX, 1.0f, fromY, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setInterpolator(interpolator); scaleAnimation.setDuration(duration); imageViewInterface.clearAnimation(); imageViewInterface.setImageDrawable(newDrawable); imageViewInterface.startAnimation(scaleAnimation); }
9. FragmentManager#makeOpenCloseAnimation()
Project: CodenameOne
File: FragmentManager.java
File: FragmentManager.java
static Animation makeOpenCloseAnimation(Context context, float startScale, float endScale, float startAlpha, float endAlpha) { AnimationSet set = new AnimationSet(false); ScaleAnimation scale = new ScaleAnimation(startScale, endScale, startScale, endScale, Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f); scale.setInterpolator(DECELERATE_QUINT); scale.setDuration(ANIM_DUR); set.addAnimation(scale); AlphaAnimation alpha = new AlphaAnimation(startAlpha, endAlpha); alpha.setInterpolator(DECELERATE_CUBIC); alpha.setDuration(ANIM_DUR); set.addAnimation(alpha); return set; }
10. Letterbox#animateRight()
Project: droid-comic-viewer
File: Letterbox.java
File: Letterbox.java
private void animateRight(long duration) { // Utils.logFrame("right", mLetterboxRight); float leftScale = (float) mLetterboxWidth / (float) mLetterboxLeft.getWidth(); ScaleAnimation rightAnimation = new ScaleAnimation(1, leftScale, 1, 1, mLetterboxRight.getWidth(), 0); rightAnimation.setAnimationListener(new AnimationListener() { public void onAnimationEnd(Animation animation) { mLetterboxRight.clearAnimation(); layoutRight(); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStart(Animation animation) { } }); configureAndStart(mLetterboxRight, rightAnimation, duration); }
11. Letterbox#animateLeft()
Project: droid-comic-viewer
File: Letterbox.java
File: Letterbox.java
private void animateLeft(long duration) { // Utils.logFrame("left", mLetterboxLeft); float leftScale = (float) mLetterboxWidth / (float) mLetterboxLeft.getWidth(); ScaleAnimation leftAnimation = new ScaleAnimation(1, leftScale, 1, 1, 0, 0); leftAnimation.setAnimationListener(new AnimationListener() { public void onAnimationEnd(Animation animation) { mLetterboxLeft.clearAnimation(); layoutLeft(); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStart(Animation animation) { } }); configureAndStart(mLetterboxLeft, leftAnimation, duration); }
12. Letterbox#animateBottom()
Project: droid-comic-viewer
File: Letterbox.java
File: Letterbox.java
private void animateBottom(long duration) { // Utils.logFrame("bottom", mLetterboxBottom); float topScale = (float) mLetterboxHeight / (float) mLetterboxTop.getHeight(); ScaleAnimation bottomAnimation = new ScaleAnimation(1, 1, 1, topScale, 0, mLetterboxBottom.getHeight()); bottomAnimation.setAnimationListener(new AnimationListener() { public void onAnimationEnd(Animation animation) { mLetterboxBottom.clearAnimation(); layoutBottom(); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStart(Animation animation) { } }); configureAndStart(mLetterboxBottom, bottomAnimation, duration); }
13. Letterbox#animateTop()
Project: droid-comic-viewer
File: Letterbox.java
File: Letterbox.java
private void animateTop(long duration) { // Utils.logFrame("top", mLetterboxTop); float topScale = (float) mLetterboxHeight / (float) mLetterboxTop.getHeight(); ScaleAnimation topAnimation = new ScaleAnimation(1, 1, 1, topScale, 0, 0); topAnimation.setAnimationListener(new AnimationListener() { public void onAnimationEnd(Animation animation) { // TODO: Find out why is this needed. mLetterboxTop.clearAnimation(); layoutTop(); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStart(Animation animation) { } }); configureAndStart(mLetterboxTop, topAnimation, duration); }
14. RippleView#onSizeChanged()
Project: ZDepthShadow
File: RippleView.java
File: RippleView.java
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); WIDTH = w; HEIGHT = h; scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2); scaleAnimation.setDuration(zoomDuration); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setRepeatCount(1); }
15. RippleView#onSizeChanged()
Project: UltimateAndroid
File: RippleView.java
File: RippleView.java
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); WIDTH = w; HEIGHT = h; scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2); scaleAnimation.setDuration(zoomDuration); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setRepeatCount(1); }
16. RadialMenuWidget#onCloseAnimation()
Project: afwall
File: RadialMenuWidget.java
File: RadialMenuWidget.java
private void onCloseAnimation() { //rotate = new RotateAnimation(360, 0, xPosition, yPosition); scale = new ScaleAnimation(1, 0, 1, 0, xPosition, yPosition); scale.setInterpolator(new AccelerateInterpolator()); move = new TranslateAnimation(0, xSource - xPosition, 0, ySource - yPosition); spriteAnimation = new AnimationSet(true); //spriteAnimation.addAnimation(rotate); spriteAnimation.addAnimation(scale); spriteAnimation.addAnimation(move); spriteAnimation.setDuration(animationSpeed); startAnimation(spriteAnimation); }
17. RadialMenuWidget#onOpenAnimation()
Project: afwall
File: RadialMenuWidget.java
File: RadialMenuWidget.java
private void onOpenAnimation() { //rotate = new RotateAnimation(0, 360, xPosition, yPosition); //rotate.setRepeatMode(Animation.REVERSE); //rotate.setRepeatCount(Animation.INFINITE); scale = new ScaleAnimation(0, 1, 0, 1, xPosition, yPosition); //scale.setRepeatMode(Animation.REVERSE); //scale.setRepeatCount(Animation.INFINITE); scale.setInterpolator(new DecelerateInterpolator()); move = new TranslateAnimation(xSource - xPosition, 0, ySource - yPosition, 0); spriteAnimation = new AnimationSet(true); //spriteAnimation.addAnimation(rotate); spriteAnimation.addAnimation(scale); spriteAnimation.addAnimation(move); spriteAnimation.setDuration(animationSpeed); startAnimation(spriteAnimation); }
18. RevealatorHelper#translateAndHideView()
Project: Revealator
File: RevealatorHelper.java
File: RevealatorHelper.java
/** * Helps to translate a view to another view. * * @param fromView From view. * @param toView Target view. * @param duration Duration. */ static void translateAndHideView(final View fromView, View toView, long duration) { // - Determine translate delta. int[] fromLocation = new int[2]; fromView.getLocationOnScreen(fromLocation); int[] toLocation = new int[2]; toView.getLocationOnScreen(toLocation); int toX = toLocation[0] - fromLocation[0] + toView.getMeasuredWidth() / 2 - fromView.getMeasuredWidth() / 2; int toY = toLocation[1] - fromLocation[1] + toView.getMeasuredHeight() / 2 - fromView.getMeasuredHeight() / 2; // - Prepare translate animation. final TranslateAnimation translateAnimation = new TranslateAnimation(0, toX, 0, toY); translateAnimation.setDuration(duration); translateAnimation.setInterpolator(new AccelerateInterpolator()); // - Prepare hide animation. final ScaleAnimation hideAnimation = new ScaleAnimation(fromView.getScaleX(), 0, fromView.getScaleY(), 0, Animation.ABSOLUTE, toX + fromView.getMeasuredWidth() / 2, Animation.ABSOLUTE, toY + fromView.getMeasuredHeight() / 2); hideAnimation.setDuration(duration / 5); hideAnimation.setStartOffset((long) (duration * 0.9)); hideAnimation.setInterpolator(new BounceInterpolator()); // - Prepare animations set. final AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(translateAnimation); animationSet.addAnimation(hideAnimation); animationSet.setAnimationListener(new AnimationListenerAdapter() { @Override public void onAnimationEnd(Animation animation) { fromView.setVisibility(View.INVISIBLE); } }); // - Let's move ! fromView.startAnimation(animationSet); }
19. AppStart#startAnima()
Project: GanWuMei
File: AppStart.java
File: AppStart.java
private void startAnima() { ScaleAnimation animation = new ScaleAnimation(1.0f, 1.5f, 1.0f, 1.5f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setInterpolator(new DecelerateInterpolator()); animation.setDuration(2000); animation.setFillAfter(true); ivSplash.startAnimation(animation); }
20. ViewUtils#wave()
Project: actor-platform
File: ViewUtils.java
File: ViewUtils.java
public static void wave(final View layer, float scale, int duration, float stepOffset) { final ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, scale, 1.0f, scale, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5); scaleAnimation.setDuration(duration); scaleAnimation.setInterpolator(new OffsetCycleInterpolator(stepOffset)); scaleAnimation.setRepeatCount(Animation.INFINITE); layer.clearAnimation(); layer.startAnimation(scaleAnimation); }
21. SplashActivity#startAnim()
Project: zhsz
File: SplashActivity.java
File: SplashActivity.java
private void startAnim() { AnimationSet set = new AnimationSet(false); //???? RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); //?????? rotateAnimation.setDuration(1000); // ?????? rotateAnimation.setFillAfter(true); //???? ScaleAnimation scaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setDuration(1000); scaleAnimation.setFillAfter(true); //???? AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1); alphaAnimation.setDuration(2000); alphaAnimation.setFillAfter(true); set.addAnimation(rotateAnimation); set.addAnimation(scaleAnimation); set.addAnimation(alphaAnimation); // ?????? set.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } // ?????? @Override public void onAnimationEnd(Animation animation) { jumpNextPage(); } @Override public void onAnimationRepeat(Animation animation) { } }); rl_root.startAnimation(set); }
22. AnimateFactory#zoomAnimation()
Project: TvWidget
File: AnimateFactory.java
File: AnimateFactory.java
/** * ????,?????? * * @param startScale ????????? * @param endScale ????????? * @return */ 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); return anim; }
23. MasterLayout#setAnimation()
Project: TH-ProgressButton
File: MasterLayout.java
File: MasterLayout.java
private void setAnimation() { // Setting up and defining view animations. arcRotation = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); arcRotation.setDuration(1000); in = new AnimationSet(true); out = new AnimationSet(true); out.setInterpolator(new AccelerateDecelerateInterpolator()); in.setInterpolator(new AccelerateDecelerateInterpolator()); scale_in = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scale_out = new ScaleAnimation(1.0f, 3.0f, 1.0f, 3.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); new_scale_in = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); new_scale_in.setDuration(200); fade_in = new AlphaAnimation(0.0f, 1.0f); fade_out = new AlphaAnimation(1.0f, 0.0f); scale_in.setDuration(150); scale_out.setDuration(150); fade_in.setDuration(150); fade_out.setDuration(150); in.addAnimation(scale_in); in.addAnimation(fade_in); out.addAnimation(fade_out); out.addAnimation(scale_out); arcRotation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation arg0) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation arg0) { // TODO Auto-generated method stub } @Override public void onAnimationEnd(Animation arg0) { // TODO Auto-generated method stub first_click = false; buttonimage.startAnimation(out); } }); out.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { // TODO Auto-generated method stub System.out.println("print this"); } @Override public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationEnd(Animation animation) { // TODO Auto-generated method stub buttonimage.setVisibility(View.GONE); buttonimage.setImageBitmap(second_icon_bmp); buttonimage.setVisibility(View.VISIBLE); buttonimage.startAnimation(in); arc_image.setVisibility(View.GONE); full_circle_image.setVisibility(View.VISIBLE); cusview.setVisibility(View.VISIBLE); flg_frmwrk_mode = 2; System.out.println("flg_frmwrk_mode" + flg_frmwrk_mode); } }); new_scale_in.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationEnd(Animation animation) { // TODO Auto-generated method stub cusview.setVisibility(View.GONE); buttonimage.setVisibility(View.VISIBLE); buttonimage.setImageBitmap(third_icon_bmp); flg_frmwrk_mode = 3; buttonimage.startAnimation(in); } }); }
24. CardCarouselLayout#exitLeft()
Project: mixpanel-android
File: CardCarouselLayout.java
File: CardCarouselLayout.java
private Animation exitLeft() { final AnimationSet set = new AnimationSet(false); final RotateAnimation rotateOut = new RotateAnimation(0, -EXIT_ANGLE, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_X, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_Y); rotateOut.setDuration(ANIMATION_DURATION_MILLIS); rotateOut.setStartOffset(ANIMATION_DURATION_MILLIS - ANIMATION_ROTATION_MILLIS); set.addAnimation(rotateOut); final ScaleAnimation scaleDown = new ScaleAnimation(1, EXIT_SIZE, 1, EXIT_SIZE, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_X, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_Y); scaleDown.setDuration(ANIMATION_DURATION_MILLIS); scaleDown.setStartOffset(ANIMATION_DURATION_MILLIS - ANIMATION_ROTATION_MILLIS); set.addAnimation(scaleDown); final TranslateAnimation slideX = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1, Animation.RELATIVE_TO_PARENT, -2.3f, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0); slideX.setInterpolator(new AccelerateInterpolator()); slideX.setDuration(ANIMATION_DURATION_MILLIS); set.addAnimation(slideX); return set; }
25. CardCarouselLayout#exitRight()
Project: mixpanel-android
File: CardCarouselLayout.java
File: CardCarouselLayout.java
private Animation exitRight() { final AnimationSet set = new AnimationSet(false); final RotateAnimation rotateOut = new RotateAnimation(0, EXIT_ANGLE, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_X, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_Y); rotateOut.setDuration(ANIMATION_ROTATION_MILLIS); rotateOut.setStartOffset(ANIMATION_DURATION_MILLIS - ANIMATION_ROTATION_MILLIS); set.addAnimation(rotateOut); final ScaleAnimation scaleDown = new ScaleAnimation(1, EXIT_SIZE, 1, EXIT_SIZE, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_X, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_Y); scaleDown.setDuration(ANIMATION_ROTATION_MILLIS); scaleDown.setStartOffset(ANIMATION_DURATION_MILLIS - ANIMATION_ROTATION_MILLIS); set.addAnimation(scaleDown); final TranslateAnimation slideX = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.3f, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0); slideX.setInterpolator(new AccelerateInterpolator()); slideX.setDuration(ANIMATION_DURATION_MILLIS); set.addAnimation(slideX); return set; }
26. AnimationUtil#getAmplificationAnimation()
Project: AndroidStudyDemo
File: AnimationUtil.java
File: AnimationUtil.java
/** * ???????? * * @param durationMillis * @param animationListener * @return */ 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; }
27. AnimationUtil#getLessenScaleAnimation()
Project: AndroidStudyDemo
File: AnimationUtil.java
File: AnimationUtil.java
/** * ???????? * * @param durationMillis * @param animationListener * @return */ 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; }
28. AnimateUtils#zoomAnimation()
Project: Android-tv-widget
File: AnimateUtils.java
File: AnimateUtils.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); return anim; }
29. SurveyActivity#onCreateInAppNotification()
Project: mixpanel-android
File: SurveyActivity.java
File: SurveyActivity.java
@SuppressWarnings("deprecation") private void onCreateInAppNotification(Bundle savedInstanceState) { setContentView(R.layout.com_mixpanel_android_activity_notification_full); final ImageView backgroundImage = (ImageView) findViewById(R.id.com_mixpanel_android_notification_gradient); final FadingImageView inAppImageView = (FadingImageView) findViewById(R.id.com_mixpanel_android_notification_image); final TextView titleView = (TextView) findViewById(R.id.com_mixpanel_android_notification_title); final TextView subtextView = (TextView) findViewById(R.id.com_mixpanel_android_notification_subtext); final Button ctaButton = (Button) findViewById(R.id.com_mixpanel_android_notification_button); final LinearLayout closeButtonWrapper = (LinearLayout) findViewById(R.id.com_mixpanel_android_button_exit_wrapper); final UpdateDisplayState.DisplayState.InAppNotificationState notificationState = (UpdateDisplayState.DisplayState.InAppNotificationState) mUpdateDisplayState.getDisplayState(); final InAppNotification inApp = notificationState.getInAppNotification(); // Layout final Display display = getWindowManager().getDefaultDisplay(); final Point size = new Point(); display.getSize(size); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { final RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) closeButtonWrapper.getLayoutParams(); // make bottom margin 6% of screen height params.setMargins(0, 0, 0, (int) (size.y * 0.06f)); closeButtonWrapper.setLayoutParams(params); } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { backgroundImage.setBackgroundColor(getResources().getColor(R.color.com_mixpanel_android_inapp_dark_translucent)); } else { backgroundImage.setBackgroundColor(getResources().getColor(R.color.com_mixpanel_android_inapp_dark_translucent, null)); } titleView.setText(inApp.getTitle()); subtextView.setText(inApp.getBody()); inAppImageView.setImageBitmap(inApp.getImage()); final String ctaUrl = inApp.getCallToActionUrl(); if (ctaUrl != null && ctaUrl.length() > 0) { ctaButton.setText(inApp.getCallToAction()); } // Listeners ctaButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String uriString = inApp.getCallToActionUrl(); if (uriString != null && uriString.length() > 0) { Uri uri; try { uri = Uri.parse(uriString); } catch (final IllegalArgumentException e) { Log.i(LOGTAG, "Can't parse notification URI, will not take any action", e); return; } try { final Intent viewIntent = new Intent(Intent.ACTION_VIEW, uri); SurveyActivity.this.startActivity(viewIntent); mMixpanel.getPeople().trackNotification("$campaign_open", inApp); } catch (final ActivityNotFoundException e) { Log.i(LOGTAG, "User doesn't have an activity for notification URI"); } } finish(); UpdateDisplayState.releaseDisplayState(mIntentId); } }); ctaButton.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { v.setBackgroundResource(R.drawable.com_mixpanel_android_cta_button_highlight); } else { v.setBackgroundResource(R.drawable.com_mixpanel_android_cta_button); } return false; } }); closeButtonWrapper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); UpdateDisplayState.releaseDisplayState(mIntentId); } }); // Animations final ScaleAnimation scale = new ScaleAnimation(.95f, 1.0f, .95f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 1.0f); scale.setDuration(200); inAppImageView.startAnimation(scale); final TranslateAnimation translate = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.0f); translate.setInterpolator(new DecelerateInterpolator()); translate.setDuration(200); titleView.startAnimation(translate); subtextView.startAnimation(translate); ctaButton.startAnimation(translate); final Animation fadeIn = AnimationUtils.loadAnimation(this, R.anim.com_mixpanel_android_fade_in); closeButtonWrapper.startAnimation(fadeIn); if (InAppNotification.Style.LIGHT.equalsName(inApp.getStyle())) { showLightStyle(); } }
30. CardCarouselLayout#enterLeft()
Project: mixpanel-android
File: CardCarouselLayout.java
File: CardCarouselLayout.java
private Animation enterLeft() { final AnimationSet set = new AnimationSet(false); final RotateAnimation rotateIn = new RotateAnimation(-EXIT_ANGLE, 0, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_X, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_Y); rotateIn.setDuration(ANIMATION_ROTATION_MILLIS); set.addAnimation(rotateIn); final ScaleAnimation scaleUp = new ScaleAnimation(EXIT_SIZE, 1, EXIT_SIZE, 1, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_X, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_Y); scaleUp.setDuration(ANIMATION_ROTATION_MILLIS); set.addAnimation(scaleUp); final TranslateAnimation slideX = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.3f, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0); slideX.setDuration(ANIMATION_DURATION_MILLIS); set.addAnimation(slideX); return set; }
31. CardCarouselLayout#enterRight()
Project: mixpanel-android
File: CardCarouselLayout.java
File: CardCarouselLayout.java
private Animation enterRight() { final AnimationSet set = new AnimationSet(false); final RotateAnimation rotateIn = new RotateAnimation(EXIT_ANGLE, 0, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_X, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_Y); rotateIn.setDuration(ANIMATION_ROTATION_MILLIS); set.addAnimation(rotateIn); final ScaleAnimation scaleUp = new ScaleAnimation(EXIT_SIZE, 1, EXIT_SIZE, 1, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_X, Animation.RELATIVE_TO_SELF, EXIT_ROTATION_CENTER_Y); scaleUp.setDuration(ANIMATION_ROTATION_MILLIS); set.addAnimation(scaleUp); final TranslateAnimation slideX = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 1.3f, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0); slideX.setDuration(ANIMATION_DURATION_MILLIS); set.addAnimation(slideX); return set; }
32. KJAnimations#getScaleAnimation()
Project: KJFrameForAndroid
File: KJAnimations.java
File: KJAnimations.java
/** * ?? Scale */ 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; }
33. KJAnimations#getScaleAnimation()
Project: KJFrameForAndroid
File: KJAnimations.java
File: KJAnimations.java
/** * ?? Scale */ 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; }
34. KJAnimations#getScaleAnimation()
Project: KJBlog
File: KJAnimations.java
File: KJAnimations.java
/** * ?? Scale */ 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; }
35. KJAnimations#getScaleAnimation()
Project: KJBlog
File: KJAnimations.java
File: KJAnimations.java
/** * ?? Scale */ 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; }
36. SuperImageView#createAnimation()
Project: droid-comic-viewer
File: SuperImageView.java
File: SuperImageView.java
private AnimationSet createAnimation(final int newWidth, final int newScrollX, final int newScrollY, long duration) { final AnimationSet animation = new AnimationSet(true); animation.setFillAfter(true); animation.setInterpolator(new DecelerateInterpolator()); final float scale = (float) newWidth / (float) getWidth(); final int fromXDelta = getScrollX(); final int fromYDelta = getScrollY(); this.scrollTo(0, 0); int toXDelta = Math.round((float) newScrollX / scale); int toYDelta = Math.round((float) newScrollY / scale); // Because the imageSwitcher centers the view if smaller final int fromXCenteringDelta = Math.max(getRootViewWidth() - getWidth(), 0) / 2; final int toXCenteringDelta = Math.max(getRootViewWidth() - newWidth, 0) / 2; final int xCenteringDelta = Math.round((toXCenteringDelta - fromXCenteringDelta) / scale); toXDelta -= xCenteringDelta; final int newHeight = Math.round((float) getOriginalHeight() * (float) newWidth / (float) getOriginalWidth()); final int fromYCenteringDelta = Math.max(getRootViewHeight() - getHeight(), 0) / 2; final int toYCenteringDelta = Math.max(getRootViewHeight() - newHeight, 0) / 2; final int yCenteringDelta = Math.round((toYCenteringDelta - fromYCenteringDelta) / scale); toYDelta -= yCenteringDelta; final TranslateAnimation translateAnimation = new TranslateAnimation(-fromXDelta, -toXDelta, -fromYDelta, -toYDelta); translateAnimation.setDuration(duration); animation.addAnimation(translateAnimation); final ScaleAnimation scaleAnimation = new ScaleAnimation(1, scale, 1, scale); scaleAnimation.setDuration(duration); animation.addAnimation(scaleAnimation); return animation; }
37. ShowFullScreenQrView#showPicFromPosition()
Project: bither-android
File: ShowFullScreenQrView.java
File: ShowFullScreenQrView.java
public void showPicFromPosition(final String content, final Bitmap placeHolder, final int x, final int y, final int width) { initView(); setVisibility(View.VISIBLE); iv.setVisibility(View.INVISIBLE); ivPlaceHolder.setImageBitmap(placeHolder); final int size = Math.min(screenHeight, screenWidth); new Thread() { public void run() { final Bitmap bmp = Qr.bitmap(content, size); post(new Runnable() { @Override public void run() { iv.setImageBitmap(bmp); iv.setVisibility(View.VISIBLE); } }); } ; }.start(); AlphaAnimation animAlpha = new AlphaAnimation(0, 1); animAlpha.setDuration(AnimationDuration); vMask.startAnimation(animAlpha); int toX = 0; int toY = (screenHeight - statusBarHeight - screenWidth) / 2 + statusBarHeight; int toWidth = UIUtil.getScreenWidth(); float scale = (float) width / (float) toWidth; ScaleAnimation animScale = new ScaleAnimation(scale, 1, scale, 1); animScale.setDuration(AnimationDuration); TranslateAnimation animTrans = new TranslateAnimation(x - toX, 0, y - toY, 0); animTrans.setDuration(AnimationDuration); AnimationSet animSet = new AnimationSet(true); animSet.setFillBefore(true); animSet.setDuration(AnimationDuration); animSet.addAnimation(animScale); animSet.addAnimation(animTrans); flImages.startAnimation(animSet); }
38. SplashActivity#onCreate()
Project: weex
File: SplashActivity.java
File: SplashActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); View textView = findViewById(R.id.fullscreen_content); ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); RotateAnimation rotateAnimation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); AnimationSet animationSet = new AnimationSet(false); animationSet.addAnimation(scaleAnimation); animationSet.addAnimation(rotateAnimation); animationSet.setDuration(1500); animationSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { startActivity(new Intent(SplashActivity.this, IndexActivity.class)); finish(); } @Override public void onAnimationRepeat(Animation animation) { } }); textView.startAnimation(animationSet); }
39. RippleView#onSizeChanged()
Project: RippleEffect
File: RippleView.java
File: RippleView.java
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); WIDTH = w; HEIGHT = h; scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2); scaleAnimation.setDuration(zoomDuration); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setRepeatCount(1); }
40. RippleView#onSizeChanged()
Project: photo-picker-plus-android
File: RippleView.java
File: RippleView.java
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); WIDTH = w; HEIGHT = h; scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2); scaleAnimation.setDuration(zoomDuration); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setRepeatCount(1); }
41. RippleView#onSizeChanged()
Project: Numer
File: RippleView.java
File: RippleView.java
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); WIDTH = w; HEIGHT = h; scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2); scaleAnimation.setDuration(zoomDuration); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setRepeatCount(1); }
42. RippleView#onSizeChanged()
Project: MaterialPageStateLayout
File: RippleView.java
File: RippleView.java
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); WIDTH = w; HEIGHT = h; scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2); scaleAnimation.setDuration(zoomDuration); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setRepeatCount(1); }
43. RippleView#onSizeChanged()
Project: LinLock
File: RippleView.java
File: RippleView.java
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); WIDTH = w; HEIGHT = h; scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2); scaleAnimation.setDuration(zoomDuration); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setRepeatCount(1); }
44. AnimationActivity#onZoomOut()
Project: kstyle
File: AnimationActivity.java
File: AnimationActivity.java
public void onZoomOut(View view) { ScaleAnimation animation = (ScaleAnimation) AnimationUtils.loadAnimation(this, R.anim.zoom_out); view.startAnimation(animation); }
45. AnimationActivity#onZoomIn()
Project: kstyle
File: AnimationActivity.java
File: AnimationActivity.java
public void onZoomIn(View view) { ScaleAnimation animation = (ScaleAnimation) AnimationUtils.loadAnimation(this, R.anim.zoom_in); view.startAnimation(animation); }
46. RippleView#onSizeChanged()
Project: Conquer
File: RippleView.java
File: RippleView.java
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); WIDTH = w; HEIGHT = h; scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2); scaleAnimation.setDuration(zoomDuration); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setRepeatCount(1); }
47. DialogCropPhotoTransit#initInAnim()
Project: bither-android
File: DialogCropPhotoTransit.java
File: DialogCropPhotoTransit.java
private void initInAnim() { inAnim = new AnimationSet(true); int imageWidth = mFromRect.right - mFromRect.left; int imageHeight = mFromRect.bottom - mFromRect.top; pauseScaleFactor = (float) imageSize / (float) Math.min(imageWidth, imageHeight); ScaleAnimation scaleAnim = new ScaleAnimation(1, pauseScaleFactor, 1, pauseScaleFactor, 0.5f, 0.5f); pauseLeft = (screenWidth - imageWidth * pauseScaleFactor) / 2 - mFromRect.left; pauseTop = (screenHeight - imageHeight * pauseScaleFactor) / 2 - mFromRect.top; TranslateAnimation transAnim = new TranslateAnimation(0, pauseLeft, 0, pauseTop); inAnim.addAnimation(scaleAnim); inAnim.addAnimation(transAnim); inAnim.setDuration(500); inAnim.setFillAfter(true); inAnim.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation animation) { inAnimFinished = false; isAnimationStarted = true; } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { inAnimFinished = true; } }); }
48. DialogCropPhotoTransit#initOutAnim()
Project: bither-android
File: DialogCropPhotoTransit.java
File: DialogCropPhotoTransit.java
private void initOutAnim() { outAnim = new AnimationSet(true); int imageWidth = mToRect.right - mToRect.left; int imageHeight = mToRect.bottom - mToRect.top; float scaleFactor = (float) Math.min(imageWidth, imageHeight) / (float) Math.min(mFromRect.right - mFromRect.left, mFromRect.bottom - mFromRect.top); ScaleAnimation scaleAnim = new ScaleAnimation(pauseScaleFactor, scaleFactor, pauseScaleFactor, scaleFactor, 0.5f, 0.5f); TranslateAnimation transAnim = new TranslateAnimation(pauseLeft, mToRect.left - mFromRect.left, pauseTop, mToRect.top - mFromRect.top); outAnim.addAnimation(scaleAnim); outAnim.addAnimation(transAnim); outAnim.setDuration(500); outAnim.setFillAfter(true); outAnim.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation animation) { } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { mIv.setImageBitmap(null); if (finalImageView != null) { finalImageView.setImageBitmap(bitmap); if (postRun != null) { finalImageView.postDelayed(postRun, 50); } } if (finalImage != null) { finalImage.setVisibility(View.VISIBLE); } dismiss(); } }); }