Skip to content

Commit

Permalink
feat: add "pause" mui-series modifier to rollback to pause behavior
Browse files Browse the repository at this point in the history
Allow to enforce the previous paused behavior with a "mui-pause" modifier on `mui-series` elements.

See foundation#97
  • Loading branch information
ncoden committed May 4, 2018
1 parent 11dde5e commit efd6e38
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/_settings.scss
Expand Up @@ -57,5 +57,6 @@ $motion-ui-settings: (
hinge-and-fade: true,
scale-and-fade: true,
spin-and-fade: true,
pause-queue-class: 'pause',
activate-queue-class: 'is-animating',
) !default;
18 changes: 14 additions & 4 deletions src/util/_series.scss
@@ -1,10 +1,12 @@
$-mui-queue: ();

/// Pauses the animation on an element by default, and then plays it when an active class is added to a parent. Also sets the fill mode of the animation to `both`. This pauses the element at the first frame of the animation, and holds it in place at the end.
/// Pauses the animation on an element by default, and then plays it when an active class is added to a parent.
/// This is not supported by Safari. See https://git.io/motion-ui-97
///
/// @since v1.3.0
/// @access private
%animated-element {
%paused-element {
animation-play-state: paused;
animation-fill-mode: both;

.#{map-get($motion-ui-settings, activate-queue-class)} & {
animation-play-state: running;
Expand Down Expand Up @@ -56,7 +58,15 @@ $-mui-queue: ();
animation-fill-mode: both;

// By default, animation name is set to start the animation
.#{map-get($motion-ui-settings, activate-queue-class)} & {
.#{map-get($motion-ui-settings, activate-queue-class)} &,
// For pausable animation, animation name must be initialy set
.#{map-get($motion-ui-settings, pause-queue-class)} & {
@include mui-animation($kf);
}

// Pausable animation.
// This was the behavior before v1.3.0. See https://git.io/motion-ui-97
.#{map-get($motion-ui-settings, pause-queue-class)} & {
@extend %paused-element;
}
}

0 comments on commit efd6e38

Please sign in to comment.