Camera
const Camera: TaggedStruct<"Camera", {
Variable: Camera
const Camera: TaggedStruct<"Camera", {
aperture: withConstructorDefault<Number>;
focalLength: withConstructorDefault<Number>;
focusDistance: withConstructorDefault<Number>;
poi: withConstructorDefault<NullOr<TaggedStruct<"Vec3", {
x: withConstructorDefault<Number>;
y: withConstructorDefault<Number>;
z: withConstructorDefault<Number>;
}>>>;
position: withConstructorDefault<TaggedStruct<"Vec3", {
x: withConstructorDefault<Number>;
y: withConstructorDefault<Number>;
z: withConstructorDefault<Number>;
}>>;
rotation: withConstructorDefault<TaggedStruct<"Vec3", {
x: withConstructorDefault<Number>;
y: withConstructorDefault<Number>;
z: withConstructorDefault<Number>;
}>>;
}>;Defined in: packages/motion/src/Entity.ts:344
The viewpoint — the one entity that is never drawn.
Remarks
A camera is view state rather than content, so it carries position and
rotation but no scale, opacity, or visible, and is absent from the
frame's instance map. Every scene has one already; reach for it with
Scene.camera.
focalLength sets the perspective strength — a longer lens flattens
depth, a shorter one exaggerates it. It and the resting z are
width-relative and filled in by the runner at instantiate time (only the
runner knows the composition width), so the zero defaults here are
placeholders that are always overwritten. The resting values are chosen so
content at z = 0 renders exactly as flat 2D.
poi is an optional point of interest: when set, the camera auto-aims at
that world point and any explicit rotation composes on top of the aim.
The Camera module's helpers are the ergonomic way to drive it.
aperture and focusDistance drive depth of field. focusDistance is
the view-space distance to the sharp plane (the runner defaults it to the
resting distance, so z = 0 is in focus). aperture is the lens radius in
world units; 0 (the default) is a pinhole and bypasses DoF entirely. A
point at view distance d blurs to a disc of radius
aperture · |d − focusDistance| / d world units on the focus plane — at
rest, where one world unit is one pixel on that plane, that is its blur
radius in pixels. Rack focus is a plain tween of focusDistance.
Limits: blur is computed from the depth buffer, so it is correct for opaque shapes only — a semi-transparent shape blurs at its own depth, not what shows through it. Perspective cameras only. DoF roughly doubles the scene's draw cost (the scene renders twice per frame).