MCPcopy Create free account
hub / github.com/Barrior/JParticles / calcOffsetTop

Method calcOffsetTop

src/wave-loading.ts:237–256  ·  view source on GitHub ↗

* 根据进度计算波纹 offsetTop 值

()

Source from the content-addressed store, hash-verified

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 * 窗口尺寸调整事件

Callers 1

mainDrawingMethod · 0.95

Calls 1

setOffsetTopMethod · 0.95

Tested by

no test coverage detected