import { Entity, LabelGraphics, useCesium } from "resium"; import { Cartesian2, Cartesian3, Color, LabelStyle } from "cesium"; import { Fragment, useCallback, useState } from "react"; import { useInterval } from "ahooks"; function Labels() { const { viewer } = useCesium(); const [show, setShow] = useState(false); const showAnimate = useCallback(() => { const { currentTime, stopTime } = viewer.clock; const leftTime = Math.floor( stopTime.secondsOfDay - currentTime.secondsOfDay ); if (leftTime < 5) { setShow(true); } else if (show) setShow(false); }, [show]); useInterval(showAnimate, 100); return ( ); } export default Labels;