Skip to content

@modoki/engine / index / CameraFrame

Variable: CameraFrame

const CameraFrame: Trait<{ active: boolean; anchorH: "center" | "left" | "off" | "right"; anchorPosH: number; anchorPosV: number; anchorV: "center" | "bottom" | "off" | "top"; autoAim: boolean; blendEase: string; blendTime: number; continuous: boolean; marginBottom: number; marginLeft: number; marginRight: number; marginTop: number; mode: string; }>

CameraFrame — an oriented "framing box" that the active camera fits to the viewport, so the play area stays framed across screen resolutions/aspects.

Authored ON a box entity: the entity's Transform IS the box — position = center, scale = size, rotation (Y-yaw) orients it. The camera is moved to fit this box for the chosen mode + margins (perspective dollies; orthographic sets orthoSize). A scene may hold SEVERAL CameraFrame boxes; exactly one is active (switchable at runtime, optionally with a blend — see blendTime).

When a CameraFrame drives the camera it OWNS the fit — the camera's authored position (perspective) / orthoSize (ortho) along the framing axis stops mattering; only its orientation (and the box) do.

Built with Modoki.