@atlaskit/motion
Version:
A set of utilities to apply motion in your application.
15 lines (14 loc) • 513 B
JavaScript
import { isMatchMediaAvailable } from './is-match-media-available';
/**
* Use for any programatic motions needed at runtime.
* Will return `true` if the current user prefers reduced motion.
* This is generally set through OS preferences/settings.
*/
export var isReducedMotion = function isReducedMotion() {
if (!isMatchMediaAvailable()) {
return false;
}
var _window$matchMedia = window.matchMedia('(prefers-reduced-motion: reduce)'),
matches = _window$matchMedia.matches;
return matches;
};