|
@@ -16,27 +16,18 @@ function A0Map() {
|
|
|
const mouseMoveFu = useCallback((e: MouseEvent) => {
|
|
|
let x = (e.clientX / window.innerWidth) * 2 - 1;
|
|
|
let y = -(e.clientY / window.innerHeight) * 2 + 1;
|
|
|
- // console.log("-------", x, y);
|
|
|
- x = x > 1 ? 1 : x;
|
|
|
- x = x < -1 ? -1 : x;
|
|
|
- y = y > 1 ? 1 : y;
|
|
|
- y = y < -1 ? -1 : y;
|
|
|
- if (mapBac1.current) {
|
|
|
- const dom1 = mapBac1.current;
|
|
|
- dom1.style.transform = `rotateX(${
|
|
|
- y * 2.5
|
|
|
- }deg) rotateY(${x}deg) translate(${-x * 10}px,${y * 10}px)`;
|
|
|
- }
|
|
|
- }, []);
|
|
|
|
|
|
- const [videoInd, setVidoeInd] = useState(true);
|
|
|
+ // x = x > 1 ? 1 : x < -1 ? -1 : x;
|
|
|
+ // y = y > 1 ? 1 : y < -1 ? -1 : y;
|
|
|
|
|
|
- // 视频的播放
|
|
|
- const videoPlayFu = useCallback(() => {}, []);
|
|
|
+ const moveParam = `rotateX(${y * 2.5}deg) rotateY(${x}deg) translate(${
|
|
|
+ -x * 10
|
|
|
+ }px,${y * 10}px)`;
|
|
|
|
|
|
- useEffect(() => {
|
|
|
- if (videoInd) videoPlayFu();
|
|
|
- }, [videoInd, videoPlayFu]);
|
|
|
+ if (mapBac1.current) mapBac1.current.style.transform = moveParam;
|
|
|
+ }, []);
|
|
|
+
|
|
|
+ const [videoInd, setVidoeInd] = useState(true);
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (mapBac1.current) {
|
|
@@ -52,7 +43,7 @@ function A0Map() {
|
|
|
|
|
|
// 30个动画帧div
|
|
|
const moveDiv = useMemo(() => {
|
|
|
- const arr: any = [];
|
|
|
+ const arr = [];
|
|
|
|
|
|
for (let i = 0; i <= 30; i++) {
|
|
|
arr.push(
|