Camera groups

Cameras made of other cameras.

A camera group is a virtual camera made of other virtual cameras. To Klipp it is one camera, with its own name, priority and active, and it blends in and out like any other. Inside, it decides which of its child cameras goes on screen: one at a time, with blends of its own, or a mix of several.

The child cameras belong to the group, not to Klipp: they don't take part in Klipp's priorities, and a child is on screen only while its group is. Each child is an ordinary virtual camera with a Body, an Aim and the rest.

Which one?

GroupUse it for
MixingCameraMixing cameras by weights you drive, like a cross-fade on a slider.
SequencerCameraShowing cameras one after another, like a cutscene.

Usage

Add the child cameras to the group's children, and the group to Klipp:

import { SequencerCamera, VirtualCamera } from '@pmndrs/klipp';

const cutscene = new SequencerCamera('cutscene', { priority: 20, instructions });
cutscene.children.add(new VirtualCamera('wide'));
klipp.add(cutscene);

klipp.whileOnScreen works for a child camera too: it is on screen only while its group is.

Events

Transitions between the children are dispatched on group.children, with the same events as klipp. The group's own transitions, into and out of it, are dispatched on the group. Each child also gets its own, like any virtual camera.