TransitionCamera provides seamless camera-to-camera or position-to-position transitions.

Includes C1 Hermite velocity matching (to prevent momentum hitches when switching to moving targets), critically damped spring smoothing (SmoothDamp mode), and sub-pixel arrival deadbanding.

Hierarchy (View Summary)

Constructors

  • Creates a new TransitionCamera instance

    Parameters

    • pId: string

      Unique identifier for the camera

    • pDiob: any

      VYLO Diob object for the camera

    • pManager: CameraManager

      CameraManager reference

    Returns TransitionCamera

Properties

bounds: { maxX: number; maxY: number; minX: number; minY: number }

Camera position bounds (Infinity = no limit)

cachedCameraPos: Vector2D

Cached camera position to avoid object churn

cachedGizmoPos: Vector2D

Cached gizmo position to avoid object churn

cachedTransitionPos: Vector2D

Cached transition position to avoid object churn

diob: any

VYLO Diob object representing the camera

gizmoColor: 16711935

Gizmo visualization color

gizmoLineLength: number

The length of the gizmo line

id: string

Unique identifier for this camera instance

isViewEye: boolean

Whether this camera is currently the active view eye

manager: CameraManager

Reference to the CameraManager that owns this camera

operationIgnoreTimeScale: boolean

If true, this action ignores all time scale (global and camera)

operationTimeScale: null | number

Per-action override time scale (temporary), null when not set

owner: null | GameInstance | Vector2D

The owner/target this camera belongs to (GameInstance or Vector2D) This represents who the camera is attached to or following

position: Vector2D

Current position of the camera in world space

previousPosition: Vector2D

Previous position of the camera in world space (used for velocity tracking)

randomGizmoAngle: number

The random angle for the gizmo

timeScale: number

Camera-specific time scale multiplier (1.0 = normal)

trackTargetZ: boolean

Whether to track the target's Z position and subtract it from the Y position. Enabled by default. Useful for 2.5D isometric-style games where height (Z) affects screen Y.

transitionDurationX: number

Transition duration for X axis in milliseconds

transitionDurationY: number

Transition duration for Y axis in milliseconds

transitionEaseX: EaseType

Easing function for X axis transitions

transitionEaseY: EaseType

Easing function for Y axis transitions

transitioning: boolean

Whether this camera is currently transitioning to become the view eye

transitionProgress: number

Transition progress (0-1) when becoming view eye

transitionStartPos: Vector2D

Starting position for transitions

transitionTargetPos: Vector2D

Target position for transitions

transitionTime: number

Elapsed transition time in milliseconds

type: "transition"

Camera type identifier

velocity: Vector2D

Current velocity of the camera in pixels per second

Accessors

  • get gizmoEnabled(): boolean
  • Getter for gizmoEnabled property

    Returns boolean

  • set gizmoEnabled(value: boolean): void
  • Setter for gizmoEnabled property that notifies CameraManager

    Parameters

    • value: boolean

    Returns void

  • get isActive(): boolean
  • Getter for isActive property

    Returns boolean

  • set isActive(value: boolean): void
  • Setter for isActive property that notifies CameraManager

    Parameters

    • value: boolean

    Returns void

  • get trackViewEyeZ(): boolean
  • Whether to track the view eye's Z position (alias for trackTargetZ)

    Returns boolean

  • set trackViewEyeZ(pValue: boolean): void
  • Parameters

    • pValue: boolean

    Returns void

Methods

  • Activates this camera, enabling updates

    Returns void

  • Applies global time scale to delta time for this camera

    Parameters

    • pDeltaTime: number

      Raw delta time

    Returns number

    Scaled delta time

  • Sets the target to follow in teleport fashion when idle

    Parameters

    • pTarget: any

      Entity or coordinate to stay attached to

    Returns void

  • Cancels any active transition in progress.

    Returns void

  • Clamps camera position to bounds

    Returns void

  • Clears all camera bounds

    Returns void

    // Remove all bounds restrictions
    camera.clearBounds();
  • Deactivates this camera, disabling updates

    Returns void

  • Cleans up resources when camera is destroyed

    Returns void

  • Gets the position where gizmos should be drawn for this camera

    Returns Vector2D

    Position for gizmo drawing (reuses cached object to avoid churn)

  • Gets the current target camera if transitioning to one

    Returns null | BaseCamera

  • Gets the Z value of a target if trackTargetZ is enabled, else returns 0. Used to subtract target height from Y position for 2.5D depth effects.

    Parameters

    Returns number

    The target's z value, or 0 if tracking is disabled or target has no z

  • Gets this camera's time scale

    Returns number

  • Gets the current transition position

    Returns Vector2D

    Interpolated position based on transition progress

  • Gets the true camera position for a target (GameInstance or Vector2D) For GameInstance: returns center position (where camera should be) For Vector2D: returns the position directly Reuses cached object to avoid churn

    Parameters

    Returns Vector2D

  • Disables gizmo visualization for this camera

    Returns void

  • Checks if camera is currently in a transition

    Returns boolean

  • Checks if a target is a Vector2D (has x, y properties but no mapName)

    Parameters

    Returns pTarget is Vector2D

    True if target is Vector2D, false if GameInstance

  • Called when this camera is no longer the active view eye. Can be overridden by subclasses to pause or clean up operations.

    Returns void

  • Removes this camera from being the view eye and falls back to VYLO.Client.mob

    This is useful when you want to stop using a camera but keep it alive for potential future use. The camera will continue following its target but won't be the active view eye.

    Returns void

    // Stop using this camera but keep it following
    followCamera.removeViewEye(); // Falls back to VYLO.Client.mob
  • Resets this camera's time scale to 1.0

    Returns void

  • Resets ongoing transitions when time scale changes

    Returns void

  • Sets this camera as the active view eye.

    Automatically performs a smooth seamless transition from the current view eye using the manager's default transition settings (or custom options if provided). Pass { duration: 0 } to force an immediate instant cut.

    Parameters

    • OptionalpOptions: TransitionCameraOptions

      Optional transition options (duration, ease, matchVelocity, spring, etc.)

    Returns void

    // Smooth transition using defaults (500ms, easeInOutQuad, matchVelocity: true)
    camera.setAsViewEye();

    // Instant cut
    camera.setAsViewEye({ duration: 0 });

    // Custom transition
    camera.setAsViewEye({ duration: 800, ease: 'easeOutCubic' });
  • Sets camera position bounds (Infinity = no limit in that direction)

    Parameters

    • pMinX: number

      Minimum X position (use -Infinity for no limit)

    • pMaxX: number

      Maximum X position (use Infinity for no limit)

    • pMinY: number

      Minimum Y position (use -Infinity for no limit)

    • pMaxY: number

      Maximum Y position (use Infinity for no limit)

    Returns void

    // Clamp camera to a 1000x1000 area starting at (0,0)
    camera.setBounds(0, 1000, 0, 1000);

    // Only clamp X axis, Y is free
    camera.setBounds(0, 1000, -Infinity, Infinity);
  • Sets the owner/target this camera belongs to

    Parameters

    Returns void

  • Sets transition settings for smooth camera switching

    Parameters

    Returns void

    // Single duration and ease for both axes
    camera.setSettings({ duration: 500, ease: 'easeInOutCubic' });

    // Separate settings for each axis
    camera.setSettings({
    duration: { x: 300, y: 500 },
    ease: { x: 'easeOutCubic', y: 'easeInOutCubic' }
    });
  • Sets this camera's time scale

    Parameters

    • pScale: number

    Returns void

  • Sets whether the camera should track the target's Z position (subtracted from Y)

    Parameters

    • pEnabled: boolean

      Whether tracking is enabled

    Returns void

  • Sets whether the camera should track the view eye's Z position (alias for setTrackTargetZ)

    Parameters

    • pEnabled: boolean

      Whether tracking is enabled

    Returns void

  • Enables gizmo visualization for this camera. A colored dot will be drawn at the camera's position for debugging.

    Returns void

  • Initiates a seamless transition to a target camera or coordinate.

    Immediately takes over the active view eye at the current view eye's coordinates to prevent visual popping, then smoothly eases toward the target.

    Parameters

    Returns Promise<void>

    Promise that resolves when the transition is complete

  • Updates the transition position each frame

    Parameters

    • pDeltaTime: number

      Time elapsed in milliseconds

    Returns void

  • Updates the camera's diob position with proper view eye offset This is the same for all cameras - they all need to offset the diob to center the target on screen

    Returns void

  • Updates the transition progress

    Parameters

    • pDeltaTime: number

      Time elapsed since last update in milliseconds

    Returns boolean

    True if transition is complete

  • Updates the camera's velocity based on elapsed time and position change.

    Parameters

    • pDeltaTime: number

      Elapsed time in milliseconds

    Returns void