Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 4844330

Browse files
authored
fix(animation): Update exit curves to match spec (#971)
Update components that were incorrectly using the _permanent_ exit animation (acceleration curve) to use the _temporary_ exit animation (sharp curve) instead. https://material.io/guidelines/motion/duration-easing.html#duration-easing-natural-easing-curves https://material.io/guidelines/motion/movement.html#movement-movement-in-out-of-screen-bounds
1 parent fe8f1eb commit 4844330

File tree

10 files changed

+25
-11
lines changed

10 files changed

+25
-11
lines changed

packages/mdc-animation/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ We currently have variables for the following 3 animation curves:
3333
| --- | --- | --- |
3434
| `$mdc-animation-standard-curve-timing-function` | `cubic-bezier(.4, 0, .2, 1)` | Standard curve; any animations that are visible from start to finish (e.g. a FAB transforming into a toolbar) |
3535
| `$mdc-animation-deceleration-curve-timing-function` | `cubic-bezier(0, 0, .2, 1)` | Animations that cause objects to enter the screen (e.g. a fade in) |
36-
| `$mdc-animation-acceleration-curve-timing-function` | `cubic-bezier(.4, 0, ``, 1)` | Animations that cause objects to leave the screen (e.g. a fade out) |
36+
| `$mdc-animation-acceleration-curve-timing-function` | `cubic-bezier(.4, 0, 1, 1)` | Animations that cause objects to leave the screen permanently (e.g. a fade out) |
37+
| `$mdc-animation-sharp-curve-timing-function` | `cubic-bezier(.4, 0, .6, 1)` | Animations that cause objects to leave the screen temporarily (e.g. closing a drawer) |
3738

3839
### SCSS
3940

packages/mdc-animation/_functions.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@
2323
@function mdc-animation-exit-permanent($name, $duration, $delay: 0ms) {
2424
@return $name $duration $delay $mdc-animation-acceleration-curve-timing-function;
2525
}
26+
27+
@function mdc-animation-exit-temporary($name, $duration, $delay: 0ms) {
28+
@return $name $duration $delay $mdc-animation-sharp-curve-timing-function;
29+
}

packages/mdc-animation/_mixins.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@
2727
@mixin mdc-animation-acceleration-curve {
2828
animation-timing-function: $mdc-animation-acceleration-curve-timing-function;
2929
}
30+
31+
@mixin mdc-animation-sharp-curve {
32+
animation-timing-function: $mdc-animation-sharp-curve-timing-function;
33+
}

packages/mdc-animation/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
$mdc-animation-deceleration-curve-timing-function: cubic-bezier(0, 0, .2, 1) !default;
1818
$mdc-animation-standard-curve-timing-function: cubic-bezier(.4, 0, .2, 1) !default;
1919
$mdc-animation-acceleration-curve-timing-function: cubic-bezier(.4, 0, 1, 1) !default;
20+
$mdc-animation-sharp-curve-timing-function: cubic-bezier(.4, 0, .6, 1) !default;

packages/mdc-animation/mdc-animation.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@
2828
&-acceleration-curve {
2929
@include mdc-animation-acceleration-curve;
3030
}
31+
32+
&-sharp-curve {
33+
@include mdc-animation-sharp-curve;
34+
}
3135
}

packages/mdc-checkbox/mdc-checkbox.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131

3232
@function mdc-checkbox-transition-exit($property, $delay: 0ms, $duration: $mdc-checkbox-transition-duration) {
33-
@return mdc-animation-exit-permanent($property, $duration, $delay);
33+
@return mdc-animation-exit-temporary($property, $duration, $delay);
3434
}
3535

3636
@mixin mdc-checkbox-cover-element {

packages/mdc-drawer/_mixins.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
left: 0;
113113
width: 100%;
114114
height: 100%;
115-
transition: mdc-animation-exit-permanent(opacity, 120ms);
115+
transition: mdc-animation-exit-temporary(opacity, 120ms);
116116
border-radius: inherit;
117117
background: currentColor;
118118
content: "";

packages/mdc-linear-progress/mdc-linear-progress.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
width: 100%;
2222
height: 4px;
2323
transform: translateZ(0);
24-
transition: mdc-animation-exit-permanent(opacity, 250ms);
24+
transition: mdc-animation-exit-temporary(opacity, 250ms);
2525
overflow: hidden;
2626

2727
&__bar {
@@ -30,7 +30,7 @@
3030
width: 100%;
3131
height: 100%;
3232
transform-origin: top left;
33-
transition: mdc-animation-exit-permanent(transform, 250ms);
33+
transition: mdc-animation-exit-temporary(transform, 250ms);
3434
}
3535

3636
&__bar-inner {
@@ -64,7 +64,7 @@
6464
width: 100%;
6565
height: 100%;
6666
transform-origin: top left;
67-
transition: mdc-animation-exit-permanent(transform, 250ms);
67+
transition: mdc-animation-exit-temporary(transform, 250ms);
6868
background-color: #e6e6e6;
6969
}
7070

packages/mdc-radio/mdc-radio.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $mdc-radio-transition-duration: 120ms;
2828
}
2929

3030
@function mdc-radio-exit($name) {
31-
@return mdc-animation-exit-permanent($name, $mdc-radio-transition-duration);
31+
@return mdc-animation-exit-temporary($name, $mdc-radio-transition-duration);
3232
}
3333

3434
// postcss-bem-linter: define radio

packages/mdc-select/mdc-select.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
max-width: calc(100% - #{$dd-arrow-padding});
4545
height: 32px;
4646
transition:
47-
mdc-animation-exit-permanent(border-bottom-color, 150ms),
48-
mdc-animation-exit-permanent(background-color, 150ms);
47+
mdc-animation-exit-temporary(border-bottom-color, 150ms),
48+
mdc-animation-exit-temporary(background-color, 150ms);
4949
border: none;
5050
border-bottom: 1px solid rgba(black, .12);
5151
border-radius: 0;
@@ -95,8 +95,8 @@
9595

9696
&__selected-text {
9797
transition:
98-
mdc-animation-exit-permanent(opacity, 125ms),
99-
mdc-animation-exit-permanent(transform, 125ms);
98+
mdc-animation-exit-temporary(opacity, 125ms),
99+
mdc-animation-exit-temporary(transform, 125ms);
100100
white-space: nowrap;
101101
overflow: hidden;
102102
}

0 commit comments

Comments
 (0)