* 根据进度计算波纹 offsetTop 值
()
| 235 | * 根据进度计算波纹 offsetTop 值 |
| 236 | */ |
| 237 | private calcOffsetTop() { |
| 238 | // 退出以提高性能 |
| 239 | if ( |
| 240 | !this.isCompletedImmediately && |
| 241 | this.progress >= WaveLoading.progressThreshold |
| 242 | ) { |
| 243 | return |
| 244 | } |
| 245 | |
| 246 | const maxCrestHeight = Math.max(...(this.options.crestHeight as number[])) |
| 247 | |
| 248 | const top = |
| 249 | this.progress === 100 |
| 250 | ? -maxCrestHeight |
| 251 | : Math.ceil( |
| 252 | ((100 - this.progress) / 100) * this.canvasHeight + maxCrestHeight |
| 253 | ) |
| 254 | |
| 255 | this.setOffsetTop(top) |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * 窗口尺寸调整事件 |
no test coverage detected