@@ -243,14 +243,20 @@ - (void)endBackgroundRipple {
243
243
if (!opacityVal) {
244
244
opacityVal = [NSNumber numberWithFloat: 0 ];
245
245
}
246
-
247
- // The end (tap release) animation should continue at the opacity level of the start animation.
248
- CGFloat enterDuration = (1 - opacityVal.floatValue / _maxOpacityLevel) *
249
- kMDCInkLayerFastEnterDuration ;
250
- CGFloat duration = kMDCInkLayerBaseOpacityExitDuration + enterDuration;
251
- _backgroundOpacityAnim =
252
- [self opacityAnimWithValues: @[ opacityVal, @(_maxOpacityLevel), @0 ]
253
- times: @[ @0 , @(enterDuration / duration), @1 .f ]];
246
+ CGFloat duration = kMDCInkLayerBaseOpacityExitDuration ;
247
+ if ([self isBounded ]) {
248
+ // The end (tap release) animation should continue at the opacity level of the start animation.
249
+ CGFloat enterDuration = (1 - opacityVal.floatValue / _maxOpacityLevel) *
250
+ kMDCInkLayerFastEnterDuration ;
251
+ duration += enterDuration;
252
+ _backgroundOpacityAnim =
253
+ [self opacityAnimWithValues: @[ opacityVal, @(_maxOpacityLevel), @0 ]
254
+ times: @[ @0 , @(enterDuration / duration), @1 .f ]];
255
+ } else {
256
+ _backgroundOpacityAnim =
257
+ [self opacityAnimWithValues: @[ opacityVal, @0 ]
258
+ times: @[ @0 , @1 .f ]];
259
+ }
254
260
_backgroundOpacityAnim.duration = duration;
255
261
[_backgroundRippleLayer addAnimation: _backgroundOpacityAnim
256
262
forKey: kMDCInkLayerBackgroundOpacityAnim ];
0 commit comments