Skip to content

Instantly share code, notes, and snippets.

@magnucki
Last active September 8, 2015 14:46
Show Gist options
  • Select an option

  • Save magnucki/af9a2b2ad233ed9f0087 to your computer and use it in GitHub Desktop.

Select an option

Save magnucki/af9a2b2ad233ed9f0087 to your computer and use it in GitHub Desktop.
Create a circular reveal from the center of a fragment
@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