Last active
September 8, 2015 14:46
-
-
Save magnucki/af9a2b2ad233ed9f0087 to your computer and use it in GitHub Desktop.
Create a circular reveal from the center of a fragment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override public void onResume() { | |
| super.onResume(); | |
| View rootView = getActivity().findViewById(R.id.ratingLayout); | |
| View shape = rootView.findViewById(R.id.ratingLayout); | |
| Display display = getActivity().getWindowManager().getDefaultDisplay(); | |
| Point size = new Point(); | |
| display.getSize(size); | |
| int width = size.x; | |
| int height = size.y; | |
| // Create a reveal {@link Animator} that starts clipping the view from | |
| // the center until the whole view is covered. | |
| Animator animator = ViewAnimationUtils.createCircularReveal(shape, width / 2, height / 2, 0, | |
| (float) Math.hypot(width, height)); | |
| // Set a natural ease-in/ease-out interpolator. | |
| animator.setInterpolator(new AccelerateDecelerateInterpolator()); | |
| // Finally start the animation | |
| animator.start(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment