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

Method getCameraEffect

packages/melonjs/src/camera/camera2d.ts:801–807  ·  view source on GitHub ↗

* Get the first camera effect matching the given class. * @param effectClass - the effect class to search for * @returns the first matching effect, or undefined * @example * const shake = camera.getCameraEffect(ShakeEffect);

(
		effectClass: new (...args: any[]) => T,
	)

Source from the content-addressed store, hash-verified

799 * const shake = camera.getCameraEffect(ShakeEffect);
800 */
801 getCameraEffect<T extends CameraEffect>(
802 effectClass: new (...args: any[]) => T,
803 ): T | undefined {
804 return this.cameraEffects.find((fx) => fx instanceof effectClass) as
805 | T
806 | undefined;
807 }
808
809 /**
810 * Remove a specific camera effect instance.

Callers 3

shakeMethod · 0.95
trigger.spec.jsFile · 0.80
camera.spec.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected