Frame a scene with cameras
Reframe the whole scene and cut between named views without editing the artwork.
Declare a 2D camera at the scene root and select its id with the scene’s camera attribute. Put your point of interest at center-x and center-y to bring it to the viewport center. Set zoom greater than 1 for a tighter view. roll rotates the camera axes clockwise, so artwork to the right of the center moves up at +90°. Camera framing follows the drawable transforms. The background still fills the fixed viewport. Camera defaults and projection
Cut between named views
Put a held camera track on the scene to choose the view. Put continuous numeric tracks on the individual camera to pan or zoom within that view. In the runnable camera scene, a red marker centered at scene coordinates (32, 22) appears at the following picture coordinates.
| Frame at 24 fps | Selected view | Marker position |
|---|---|---|
| 11 | Wide, the default view | (32, 22) |
| 12 | Tracking, center (35, 20) and zoom 2 | (44, 44) |
| 24 | Rolled +90° around viewport center (50, 40) | (32, 58) |
| 36 | Wide again | (32, 22) |
The tracking view has already sampled half of its center-X track by frame 12. Move the selector’s frame-12 cut to frame 18 and the camera’s center at the new cut becomes (37.5, 20). The marker then appears at (39, 44). The camera’s numeric track remains on the scene clock, independent of when it is selected. Camera-cut observations
A referenced scene frames and clips its own picture before the parent places it. This sample also places a child scene with a close camera. A parent view can reframe the result of that placement, including the child’s background. The 2D framing above is Level 1. Perspective optics are specified separately, and spatial authoring with planes is a trial. Perspective optics · Spatial camera trial
Examples
Download the complete .nothing source · Source on GitHub
Rendered with ncf-preview at 100 × 80.
Bound resources



<scene width="100" height="80" frame-rate="24" background="#101820FF" camera="wide">
<camera id="wide"/>
<camera id="tracking" center-x="30" center-y="20" zoom="2">
<animate attributeName="center-x" fill="freeze">
<key frame="0" value="30" ease="linear"/>
<key frame="24" value="40"/>
</animate>
</camera>
<camera id="rolled" roll="90"/>
<camera id="beyond" center-x="110"/>
<animate attributeName="camera" fill="freeze">
<key frame="0" value="wide" ease="hold"/>
<key frame="12" value="tracking" ease="hold"/>
<key frame="24" value="rolled" ease="hold"/>
<key frame="36" value="wide" ease="hold"/>
<key frame="48" value="beyond"/>
</animate>
<shape>
<rect anchor-u="0" anchor-v="0" offset-x="30" offset-y="20" width="4" height="4"/>
<fill><paint><solid color="#E93434FF"/></paint></fill>
</shape>
<shape>
<rect anchor-u="0" anchor-v="0" offset-x="108" offset-y="38" width="4" height="4"/>
<fill><paint><solid color="#45CF80FF"/></paint></fill>
</shape>
<sequence href="child.nothing" begin="0f" dur="49f" source-start="0s"
translate-x="70" translate-y="12"/>
</scene>