@atlaskit/motion
Version:
A set of utilities to apply motion in your application.
16 lines (15 loc) • 453 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 const isReducedMotion = () => {
if (!isMatchMediaAvailable()) {
return false;
}
const {
matches
} = window.matchMedia('(prefers-reduced-motion: reduce)');
return matches;
};