Add three.js weather aura layer to dashboard map

This commit is contained in:
2569718930@qq.com
2026-03-27 23:09:08 +08:00
parent 7237278f5a
commit e32cfd8015
7 changed files with 505 additions and 4 deletions
+26
View File
@@ -0,0 +1,26 @@
"use client";
import { useEffect, useState } from "react";
export function usePrefersReducedMotion() {
const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);
useEffect(() => {
if (typeof window === "undefined" || !window.matchMedia) {
return;
}
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
const apply = () => {
setPrefersReducedMotion(mediaQuery.matches);
};
apply();
mediaQuery.addEventListener("change", apply);
return () => {
mediaQuery.removeEventListener("change", apply);
};
}, []);
return prefersReducedMotion;
}