Skip to content

Commit

Permalink
feat: change mui-series behavior for better Safari support #97
Browse files Browse the repository at this point in the history
Do not set the animation name until it need to be played. This is the only way to control the animation start on all browsers (including latest Safari versions). See issue for more informations.

**BREAKING CHANGE**
When `.is-animating` is removed from `.mui-series`, the animation is now reset instead of paused. Setting `.is-animating` back will start the animation from its begining.

Closes #97
  • Loading branch information
ncoden committed May 6, 2018
1 parent 90f8070 commit 13bb2de
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/util/_series.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
$-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.
/// @access private
%animated-element {
animation-play-state: paused;
animation-fill-mode: both;

.#{map-get($motion-ui-settings, activate-queue-class)} & {
animation-play-state: running;
}
}

/// Creates a new animation queue.
/// @param {Duration} $delay [0s] - Delay in seconds or milliseconds to place at the front of the animation queue.
@mixin mui-series($delay: 0s) {
Expand Down Expand Up @@ -46,9 +35,15 @@ $-mui-queue: ();
$item: ($duration, $gap);
$-mui-queue: append($-mui-queue, $item) !global;

// CSS output
@extend %animated-element;
@include mui-animation($kf);
animation-duration: $duration;
animation-delay: $actual-delay;
// --- CSS output ---
// Initial properties
@include -mui-keyframe-get($kf, 0);
animation-fill-mode: both;

// Start the animation
.#{map-get($motion-ui-settings, activate-queue-class)} & {
@include mui-animation($kf);
animation-delay: $actual-delay;
animation-duration: $duration;
}
}

0 comments on commit 13bb2de

Please sign in to comment.