| | |
| | | // console.log(serviceInfo, '这里是当前方案的服务信息!'); |
| | | // 这里通过water.js中去发送请求获取水面模拟 |
| | | createWaterPrimitive({ |
| | | // baseUrl: `/simu/${serviceInfo}`, |
| | | baseUrl: `/simu/c2h1dc`, |
| | | baseUrl: `/simu/${serviceInfo}`, |
| | | // baseUrl: `/simu/c2h1dc`, |
| | | interval: intervalMap[playbackRate.value], |
| | | colorRender: isColorRenderEnabled.value |
| | | }); |
| | |
| | | }; |
| | | // 播放逻辑 |
| | | const startPlayback = () => { |
| | | // const interval = intervalMap[playbackRate.value] || 1000; // 默认为1000 |
| | | clearInterval(playInterval); // 清除之前的定时器 |
| | | |
| | | // 根据 playbackRate 设置 timeIncrement |
| | | let timeIncrement; |
| | | switch (playbackRate.value) { |
| | | case 1: |
| | | timeIncrement = 900; |
| | | break; |
| | | case 2: |
| | | timeIncrement = 1800; |
| | | break; |
| | | case 4: |
| | | timeIncrement = 3600; |
| | | break; |
| | | case 8: |
| | | timeIncrement = 5600; |
| | | break; |
| | | default: |
| | | timeIncrement = 900; // 默认为1倍速 |
| | | break; |
| | | } |
| | | playInterval = setInterval(() => { |
| | | const timeIncrement = playbackRate.value; // 倍速作为增量 |
| | | currentTime.value += timeIncrement; |
| | | if (currentTime.value >= duration.value) { |
| | | currentTime.value = duration.value; // 停在最后一帧 |
| | |
| | | // 计算播放进度百分比 [0, 1] |
| | | const progress = currentTime.value / duration.value; |
| | | emit("timeUpdate", progress * 100); // 百分比上报 |
| | | }, 1000); // 注意使用interval而非固定1000ms |
| | | }, 1000); // 固定每秒执行一次,也可以使用动态间隔(可选) |
| | | }; |
| | | // 降雨变化部分 |
| | | // 降雨数据相关变量 |