MCPcopy Create free account
hub / github.com/Fiddle-Digital/string-scroll / onScroll

Method onScroll

src/index.ts:452–490  ·  view source on GitHub ↗
(e: Event)

Source from the content-addressed store, hash-verified

450
451 }
452 private onScroll(e: Event) {
453
454 this.sEn.onScroll(e)
455 this.onScrollEvents.forEach(event => {
456 event(this.sEn.data.c)
457 });
458 this.onScrollLerpEvents.forEach(event => {
459 event(this.sEn.v)
460 });
461
462
463 if (this.sEn.v != 0 && this.isUp != 1 && this.oC < this.sEn.data.c) {
464 this.isUp = 1
465 document.documentElement.classList.add("-scroll-down")
466 document.documentElement.classList.remove("-scroll-up")
467 }
468 if (this.sEn.v != 0 && this.isUp != 2 && this.oC > this.sEn.data.c) {
469 this.isUp = 2
470 document.documentElement.classList.add("-scroll-up")
471 document.documentElement.classList.remove("-scroll-down")
472 }
473 if (this.sEn.v == 0 && this.isUp!=3) {
474 this.isUp = 3
475 document.documentElement.classList.remove("-scroll-up")
476 document.documentElement.classList.remove("-scroll-down")
477 }
478
479
480 //document.documentElement.style.setProperty("--string-lerp", Math.abs(this.sEn.v).toString())
481 this.animations.forEach((animation) => {
482 animation.scrollEmit({
483 current: this.sEn.data.c,
484 target: this.sEn.data.t,
485 value: this.sEn.v,
486 })
487 });
488 this.oC = this.sEn.data.c
489
490 }
491 private onAnimationFrame() {
492 this.animationCycle = () => {
493 this.sEn.onAnimationFrame()

Callers

nothing calls this directly

Calls 2

scrollEmitMethod · 0.80
onScrollMethod · 0.65

Tested by

no test coverage detected