Commit 0922d466 authored by Mark Cogan's avatar Mark Cogan Committed by Commit Bot

[iOS] Tune reduced motion tab grid transition.

Per the bug, add corner rounding and change the scale of the reduced motion animation.

Note that this CL uses 26px corner radius for better visibility given how brief the animation is.

Bug: 851871
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I9f2c3b02ce53abed3570f33a09017ee7a9273ed1
Reviewed-on: https://chromium-review.googlesource.com/1138618Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: Mark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575589}
parent 4102b507
...@@ -49,25 +49,34 @@ ...@@ -49,25 +49,34 @@
UIView* animatingView; UIView* animatingView;
CGFloat finalAnimatingViewAlpha; CGFloat finalAnimatingViewAlpha;
CGAffineTransform finalAnimatingViewTransform; CGAffineTransform finalAnimatingViewTransform;
CGFloat finalAnimatingCornerRadius;
if (self.presenting) { if (self.presenting) {
// If presenting, the appearing view (the tab view) animates in from 0% // If presenting, the appearing view (the tab view) animates in from 0%
// opacity and an 80% scale transform. // opacity, 75% scale transform, and a 13px corner radius
animatingView = appearingView; animatingView = appearingView;
finalAnimatingViewAlpha = animatingView.alpha; finalAnimatingViewAlpha = animatingView.alpha;
animatingView.alpha = 0; animatingView.alpha = 0;
finalAnimatingViewTransform = animatingView.transform; finalAnimatingViewTransform = animatingView.transform;
animatingView.transform = animatingView.transform =
CGAffineTransformScale(finalAnimatingViewTransform, 0.8, 0.8); CGAffineTransformScale(finalAnimatingViewTransform, 0.75, 0.75);
finalAnimatingCornerRadius = 0;
animatingView.layer.cornerRadius = 26.0;
} else { } else {
// If dismissing, the disappearing view (the tab view) animates out // If dismissing, the disappearing view (the tab view) animates out
// to 0% opacity and 80% scale. // to 0% opacity, 75% scale, and 13px corner radius.
animatingView = disappearingView; animatingView = disappearingView;
finalAnimatingViewAlpha = 0; finalAnimatingViewAlpha = 0;
finalAnimatingViewTransform = finalAnimatingViewTransform =
CGAffineTransformScale(animatingView.transform, 0.8, 0.8); CGAffineTransformScale(animatingView.transform, 0.75, 0.75);
finalAnimatingCornerRadius = 26.0;
} }
// Set clipsToBounds on the animating view so its corner radius will look
// right.
BOOL oldClipsToBounds = animatingView.clipsToBounds;
animatingView.clipsToBounds = YES;
// Animate the animating view to final properties, then clean up by removing // Animate the animating view to final properties, then clean up by removing
// the disappearing view. // the disappearing view.
[UIView animateWithDuration:[self transitionDuration:transitionContext] [UIView animateWithDuration:[self transitionDuration:transitionContext]
...@@ -76,8 +85,11 @@ ...@@ -76,8 +85,11 @@
animations:^{ animations:^{
animatingView.alpha = finalAnimatingViewAlpha; animatingView.alpha = finalAnimatingViewAlpha;
animatingView.transform = finalAnimatingViewTransform; animatingView.transform = finalAnimatingViewTransform;
animatingView.layer.cornerRadius = finalAnimatingCornerRadius;
} }
completion:^(BOOL finished) { completion:^(BOOL finished) {
// Restore clipping state.
animatingView.clipsToBounds = oldClipsToBounds;
// If the transition was cancelled, remove the disappearing view. // If the transition was cancelled, remove the disappearing view.
// If not, remove the appearing view. // If not, remove the appearing view.
if (transitionContext.transitionWasCancelled) { if (transitionContext.transitionWasCancelled) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment