MCPcopy Create free account
hub / github.com/esengine/esengine / tweenUpdate

Method tweenUpdate

packages/fairygui/src/scroll/ScrollPane.ts:877–906  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

875 }
876
877 private tweenUpdate(): void {
878 const dt = 1 / 60;
879 const nx = this.runTween('x', dt);
880 const ny = this.runTween('y', dt);
881
882 this._containerX = nx;
883 this._containerY = ny;
884
885 if (this._tweening === 2) {
886 if (this._overlapWidth > 0) {
887 this._scrollX = clamp(-nx, 0, this._overlapWidth);
888 }
889 if (this._overlapHeight > 0) {
890 this._scrollY = clamp(-ny, 0, this._overlapHeight);
891 }
892 }
893
894 if (this._tweenChangeX === 0 && this._tweenChangeY === 0) {
895 this._tweening = 0;
896 if (this._tweener) {
897 this._tweener.kill();
898 this._tweener = null;
899 }
900
901 this.emit(FGUIEvents.SCROLL);
902 this.emit(FGUIEvents.SCROLL_END);
903 } else {
904 this.emit(FGUIEvents.SCROLL);
905 }
906 }
907
908 private runTween(axis: 'x' | 'y', dt: number): number {
909 let newValue: number;

Callers 1

startTweenMethod · 0.95

Calls 4

runTweenMethod · 0.95
clampFunction · 0.70
killMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected