MCPcopy Create free account
hub / github.com/melonjs/melonJS / update

Method update

packages/melonjs/src/camera/effects/shake_effect.ts:59–77  ·  view source on GitHub ↗
(dt: number)

Source from the content-addressed store, hash-verified

57 }
58
59 override update(dt: number): void {
60 this.duration -= dt;
61 if (this.duration <= 0) {
62 this.duration = 0;
63 this.camera.offset.setZero();
64 this.isComplete = true;
65 if (typeof this.onComplete === "function") {
66 this.onComplete();
67 }
68 } else {
69 const axis = this.camera.AXIS;
70 if (this.axis === axis.BOTH || this.axis === axis.HORIZONTAL) {
71 this.camera.offset.x = (Math.random() - 0.5) * this.intensity;
72 }
73 if (this.axis === axis.BOTH || this.axis === axis.VERTICAL) {
74 this.camera.offset.y = (Math.random() - 0.5) * this.intensity;
75 }
76 }
77 }
78
79 override destroy(): void {
80 this.camera.offset.setZero();

Callers

nothing calls this directly

Calls 3

randomMethod · 0.80
setZeroMethod · 0.45
onCompleteMethod · 0.45

Tested by

no test coverage detected