Skip to content

Commit

Permalink
Fully disable animation style if enableAnimations is false. (#16893)
Browse files Browse the repository at this point in the history
  • Loading branch information
miina authored and gziolo committed Aug 29, 2019
1 parent ee4d256 commit fe19e95
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions packages/block-editor/src/components/block-list/moving-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,26 @@ function useMovingAnimation( ref, isSelected, enableAnimation, triggerAnimationO
immediate: prefersReducedMotion,
} );

return {
transformOrigin: 'center',
transform: interpolate(
[
animationProps.x,
animationProps.y,
],
( x, y ) => x === 0 && y === 0 ? undefined : `translate3d(${ x }px,${ y }px,0)`
),
zIndex: interpolate(
[
animationProps.x,
animationProps.y,
],
( x, y ) => ! isSelected || ( x === 0 && y === 0 ) ? undefined : `1`
),
};
// Dismiss animations if disabled.
return prefersReducedMotion ?
{} :
{
transformOrigin: 'center',
transform: interpolate(
[
animationProps.x,
animationProps.y,
],
( x, y ) => x === 0 && y === 0 ? undefined : `translate3d(${ x }px,${ y }px,0)`
),
zIndex: interpolate(
[
animationProps.x,
animationProps.y,
],
( x, y ) => ! isSelected || ( x === 0 && y === 0 ) ? undefined : `1`
),
};
}

export default useMovingAnimation;

0 comments on commit fe19e95

Please sign in to comment.