Camera plugin for the Kit framework, powered by @evitcastudio/lens.

Exposes high-level convenience methods for camera management, smooth tracking, spectating, cinematic panning, screen shakes, and zoom effects directly on the plugin.

import { Kit } from '@evitcastudio/kit';
import { CameraPlugin } from '@evitcastudio/lens';

Kit.registerPlugin(CameraPlugin);
const camera = Kit.getPlugin<CameraPlugin>('Camera')!;

// Direct ergonomics (no need to chain .manager)
camera.shakePreset('explosion-large');
camera.zoom(2, 500, 'easeOutCubic');

const followCam = camera.createFollowCamera();
camera.setMainFollowCamera(followCam, player, { x: 0, y: 0, z: 0 }, true);

Constructors

  • Initializes a new CameraPlugin instance.

    Parameters

    Returns Camera

Properties

manager: CameraManager

The underlying CameraManager instance from Lens.

name: string

Unique identifier for this plugin in the Kit framework.

Methods

  • Internal

    Registers the plugin with Kit's event emitter.

    Parameters

    Returns void

  • Creates a new FollowCamera instance.

    Returns FollowCamera

  • Creates a new InfluenceCamera instance.

    Parameters

    • pX: number

      Initial X position.

    • pY: number

      Initial Y position.

    • pMapName: string

      Map name for the camera.

    Returns InfluenceCamera

  • Creates a new PanCamera instance.

    Returns PanCamera

  • Creates a new SpectateCamera instance.

    Returns SpectateCamera

  • Creates a new TransitionCamera instance.

    Returns TransitionCamera

  • Destroys a camera by its ID.

    Parameters

    • pId: string

      The ID of the camera to destroy.

    Returns void

  • Emits an event through the Kit event system.

    Parameters

    • pEvent: {
          data?: Record<string, unknown>;
          event: string;
          plugin?: string;
          [key: string]: unknown;
      }

    Returns void

  • Smoothly transitions to follow a target.

    Parameters

    Returns Promise<void>

  • Gets all cameras currently managed.

    Returns BaseCamera[]

  • Gets the auto-created pan camera.

    Returns null | PanCamera

  • Gets the auto-created spectate camera.

    Returns null | SpectateCamera

  • Gets the auto-created transition camera.

    Returns null | TransitionCamera

  • Gets a camera instance by its unique ID.

    Parameters

    • pId: string

      The camera ID.

    Returns undefined | BaseCamera

  • Gets all cameras matching the specified camera type.

    Parameters

    • pType: string

      The camera type to filter by.

    Returns BaseCamera[]

  • Returns the name of the currently active shake preset, or null if none.

    Returns null | ShakePreset

  • Gets the currently active view eye camera.

    Returns null | BaseCamera

  • Gets the current zoom level of the mapView.

    Returns Vector2D

  • Gets whether debug center lines are enabled.

    Returns boolean

  • Gets the native GizmoRenderer instance.

    Returns null | GizmoRenderer

  • Gets whether global gizmo rendering is enabled.

    Returns boolean

  • Gets the global base offsets.

    Returns Readonly<{ x: number; y: number }>

  • Gets the current global time scale factor.

    Returns number

  • Gets the current main follow camera.

    Returns null | FollowCamera

  • Checks if the camera plugin has been registered with Kit.

    Returns boolean

  • Checks if the camera view eye is currently shaking.

    Returns boolean

  • Checks if the camera is currently animating zoom.

    Returns boolean

  • Subscribes a listener to camera system events directly via the plugin.

    Type Parameters

    Parameters

    Returns () => void

    Unsubscribe function

  • Lifecycle callback invoked when the plugin is registered with Kit.

    Returns void

  • Smoothly pans to a target position or entity.

    Parameters

    Returns Promise<void>

  • Enables or disables debug crosshairs / center lines.

    Parameters

    • pEnabled: boolean

      Whether debug lines should render.

    Returns void

  • Enables or configures native debug overlay mode.

    Parameters

    Returns void

  • Sets specific debug overlay options.

    Parameters

    Returns void

  • Sets global default transition settings used when switching cameras.

    Parameters

    Returns void

  • Enables or disables debug gizmos across all cameras.

    Parameters

    • pEnabled: boolean

      Whether gizmos should render.

    Returns void

  • Sets global base offsets for the view eye.

    Parameters

    • pX: number
    • pY: number

    Returns void

  • Sets the global time scale multiplier for camera animations (1.0 = normal).

    Parameters

    • pTimeScale: number

      Multiplier factor.

    Returns void

  • Toggles whether shake effects ignore time scale.

    Parameters

    • pIgnore: boolean

    Returns void

  • Toggles whether zoom effects ignore time scale.

    Parameters

    • pIgnore: boolean

    Returns void

  • Applies a custom configured shake effect on the active view eye.

    Parameters

    Returns void

  • Triggers a preset camera shake on the active view eye.

    Parameters

    • pPresetName: ShakePreset

      One of the 29 built-in presets (e.g. 'gunshot', 'explosion-large').

    • OptionalpCallback: () => void

      Optional callback when shake finishes.

    • OptionalpInfiniteOverride: boolean

      Optional boolean to force infinite shaking.

    Returns void

  • Stops the internal RAF update loop if active.

    Returns void

  • Stops the currently active shake effect.

    Returns void

  • Stops the current zoom animation.

    Returns void

  • Smoothly switches view eye to another camera via TransitionCamera.

    Parameters

    Returns Promise<void>

  • Manually advances the camera system by the given elapsed time in milliseconds. Useful when integrating into custom render loops with autoStart disabled.

    Parameters

    • pElapsedMs: number

      Elapsed milliseconds since last frame.

    Returns void

  • Transitions to an InfluenceCamera at the given position.

    Parameters

    • pX: number

      Target X coordinate.

    • pY: number

      Target Y coordinate.

    • pMapName: string

      Map name.

    Returns Promise<void>

  • Smoothly zooms the active view eye to a target zoom level.

    Parameters

    • OptionalpDestinationLevel: number | { x?: number; y?: number }

      Target zoom level (scalar or {x, y}).

    • OptionalpDuration: number | DurationSettings

      Duration in milliseconds (scalar or {x, y}).

    • OptionalpEase: EaseType | EaseSettings

      Easing curve name (e.g. 'easeOutCubic').

    • OptionalpCallback: () => void

      Callback when zoom completes.

    • OptionalpOptions: { ignoreTimeScale?: boolean; timeScale?: number }

      Optional timescale settings.

    Returns void