Extension

Adjusts the lens and the shot the Body and Aim build.

Extensions tweak a shot once the Body and Aim are done. You can add as many as you like to one virtual camera, and they run in the order they were added. Three are the exception. Lens runs first, so the Body and Aim frame with its lens. FollowZoom and Confiner run right after the Body, so the Aim frames with their field of view and from where they let the camera go. addExtension returns a function that removes one.

Which one?

ExtensionUse it for
CameraOffsetMoving the camera off center in its own space, like an over-the-shoulder view.
ConfinerKeeping the camera inside a box or a sphere, slowing down near the edge.
FollowZoomKeeping a target the same size on screen by changing the field of view, like a dolly zoom.
GroupFramingKeeping several targets in view by moving the camera closer or farther.
LensChanging fov, near and far, with damping.
RecomposerA final turn, dutch roll or zoom on top of the finished shot.

Usage

import { GroupFramingExtension, LensExtension } from '@pmndrs/klipp';

camera.addExtension(new GroupFramingExtension(members, { padding: 1 }));
const removeLens = camera.addExtension(new LensExtension({ fov: 40, fovDamping: 0.5 }));