MixingCamera

Mixes its cameras into one shot by weight.

Mixes its child cameras into one shot. Each child's share is its weight over the sum of all weights, and a weight of 0 or less leaves the child out. With one weighted child, the shot is that child's.

Unlike a blend, nothing here runs on a timer: you set the weights, every frame if you like, from a slider, a distance or a speed. Mixing works the same way as a blend at that point, so blend hints on the children apply.

The child with the highest weight is the live one: transitions on children follow it. Every child with a weight runs every frame, the others as their standbyUpdate says.

Settings

SettingDescriptionDefault
weightsWeight of each child camera, by name.{}

Usage

import { MixingCamera } from '@pmndrs/klipp';

const chase = new MixingCamera('chase', { priority: 10, weights: { calm: 1, fast: 0 } });
chase.children.add(calm);
chase.children.add(fast);
klipp.add(chase);

// every frame
chase.weights.fast = speed / maxSpeed;
chase.weights.calm = 1 - chase.weights.fast;