import { motion, AnimatePresence } from "framer-motion"; import { useRef, useEffect, useState } from "react"; import FeederStatus from "../../../../Common/Feeder"; import TemperatureBottom from "../../../../Common/TemperatureBottom"; import { useSelector } from "react-redux"; import BotttomColorBlock from "./../../components/BotttomColorBlock"; import image from "./../../../../../assets/kilnSpeed.png"; function FloorOneToTwo(props) { const fireInfo = useSelector((state) => state.fireInfo); const fireDir = fireInfo?.fireDirection || null; const [fireCanPlay, setFireCanPlay] = useState(false); const vd = useRef(null); const show = props.opacity || 0; // 是否显示溶液速度标签的内容 // 池底温度和溶液速度写在一个页面上 const showSpeed = props.floor == 3 ? true : false; //显示3 const showBottom = props.floor == 2 ? true : false; //显示2 const speed = props.preFloor == 2 || props.preFloor == 3 ? "f" : "s"; const [speedAn, setSpeedAn] = useState({}); useEffect(() => { // 2,3互切不用展示动画 if (speed === "f") { setSpeedAn({ opacity: [0, 0, 0, 0.6, 1], transition: { duration: 0.3, delay: 0 }, }); } else { if (props.floor === 3) { setSpeedAn({ opacity: [0, 0, 0, 0.6, 1], transition: { duration: 0.3, delay: 1.5 }, }); } else { setSpeedAn({}); } } }, [props.floor]); useEffect(() => { if (show) { vd.current.play(); setTimeout(() => { // console.log("开启1-2的火播放"); setFireCanPlay(true); }, 2000); } if (!show) setFireCanPlay(false); return () => { // console.log("关闭1-2的火播放"); setFireCanPlay(false); }; }, [show]); return ( {show && ( {/* 窑炉的色块 */} {showBottom && ( )} {showBottom && fireCanPlay && fireDir == "东火" && ( )} {showBottom && fireCanPlay && fireDir == "西火" && ( // {fireCanPlay && ( )} {/* 温度组件 */} {showBottom && ( )} {/* 溶液速度色块 */} {showSpeed && ( )} )} ); } export default FloorOneToTwo;