<Three>
A three.js scene on the timeline: plain three.js in setup, or React Three Fiber children, on the video's clock.
tsx
import { Clip, Composition, Three, Track } from "@cutcraft/kit";
export default function Video() {
return (
<Composition fps={30} width={960} height={540}>
<Track id="main">
<Clip id="shot" src="asset:aurora" in={0} out={3} fit="cover" />
</Track>
<Track id="scene" layout="free">
{/* Plain three.js in setup; the function it returns runs on every frame with the layer's time. */}
<Three
id="cube"
anchor="shot"
duration={3}
camera={{ position: [0, 0, 5], fov: 40 }}
setup={({ scene, THREE }) => {
const cube = new THREE.Mesh(new THREE.BoxGeometry(1.6, 1.6, 1.6), new THREE.MeshNormalMaterial());
scene.add(cube);
return ({ time }) => {
cube.rotation.set(time * 0.6, time, 0);
};
}}
/>
</Track>
</Composition>
);
}The player draws it once the host calls installFreeCodeLibraries() (Free code); the export draws it the same way, in headless Chrome (Exporting).
Used in: Product launch · Logo reveal · Brand spot in any theme
Props
| prop | type | default | required | description |
|---|---|---|---|---|
id | string | yes | The element's name: unique in the file, and what anchors, ducking and the editor refer to it by. | |
start | number (0..∞) | Seconds from the start of the video. Free-layout tracks only; on a sequence track the element follows the one before it. | ||
anchor | "start" | string | Overlays: start relative to another element's start, or to its end with id.end. | ||
at | string | With anchor: a word, shot or silence of the anchor's source (word:14655); the start is where the anchor plays it, plus offset. | ||
offset | number | Seconds added to the start that anchor and at give; negative starts earlier. | ||
duration | number (> 0) | "fill" | "source" | { match } | | How long it plays: seconds; "source" for the whole trimmed source; "fill" to run to the end of the composition; { match: id } for as long as another element; { until: id } to end when another element ends. | ||
enter | How it comes in: a fade, slide, scale or wipe over its first seconds, with an easing. | |||
exit | How it goes out, over its last seconds, as enter. | |||
transform | Moves, scales, turns and fades the whole layer, as on any element; the editor's handles write it. | |||
blend | "normal" | "multiply" | "screen" | "overlay" | "darken" | … 13 more | How the layer mixes with what is under it, as CSS mix-blend-mode does. | ||
ground | boolean | The layer is a ground that other things sit on: a wall behind a game, a scrim that darkens footage under a title. The layout check then treats it like a background: it is not held to the safe zone and is not said to cover the captions. | ||
camera | The camera: position and lookAt as [x, y, z], fov in degrees, clipping planes, zoom, or orthographic. | |||
background | string | The scene's background colour; left out, transparent over what is beneath. | ||
setup | any | Builds the scene once from { scene, camera, renderer, THREE, width, height }, and may return update(frame) for every frame. |
Timed, visual, transformable. Children: effect, keyframe. All elements