# `<scene>`

[Canonical page](https://nothing.graphics/docs/format/reference/scene) · [Page source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/docs/reference/scene.md)

Declare the canvas, clock, views and root drawing order of a complete document.

## Examples

[Download the complete .nothing source](https://nothing.graphics/format/first-scene/source.nothing) · [Source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/conformance/first-scene.nothing)

Rendered with ncf-preview at 64 × 64.

- [Still · Centered rectangle](https://nothing.graphics/format/first-scene/0.webp) at 0s. A terracotta rectangle occupies x from 8 to 48 and y from 8 to 48 on a transparent 64 × 64 canvas.

```xml
<scene width="64" height="64">
  <shape translate-x="28" translate-y="28">
    <rect width="40" height="40"/>
    <fill><paint><solid color="#CD6843FF"/></paint></fill>
  </shape>
</scene>
```



<!-- Generated by ncf/tools/reference/generate.mjs. -->

Use one unnamespaced `<scene>` root in a UTF-8 XML 1.0 file. Drawables paint over the scene background in source order.

## Syntax [#syntax]

### Give a still its own canvas [#give-a-still-its-own-canvas]

Set both canvas dimensions to 64. With no scene background, the terracotta rectangle at x = 8–48 and y = 8–48 appears on transparency.

```xml
<scene width="64" height="64">
  <shape translate-x="28" translate-y="28">
    <rect width="40" height="40"/>
    <fill><paint><solid color="#CD6843FF"/></paint></fill>
  </shape>
</scene>
```

[Complete .nothing source](https://github.com/gridaco/nothing/blob/main/ncf/conformance/first-scene.nothing) · [Sample checks](https://github.com/gridaco/nothing/blob/main/ncf/conformance/README.md#published-reference-examples)

## Usage context [#usage-context]

Use this element as the single document root.

Unknown elements, declarations of a DTD, and processing instructions require a diagnostic. Opaque extension attributes survive unrelated edits. A standalone sample needs a resolved viewport. Supply a frame rate when any placement or track is present.

## Attributes [#attributes]

[Property animation](https://nothing.graphics/docs/format/spec/animation#property-types-and-exceptions)

### `width` [#width]

**Value** scene units · **Keys** Static

Positive finite canvas width. Canvas dimensions are supplied together. With both omitted, use the caller's viewport. [Canvas and clock](https://nothing.graphics/docs/format/spec#canvas-and-clock)

### `height` [#height]

**Value** scene units · **Keys** Static

Positive finite canvas height. Canvas dimensions are supplied together. With both omitted, use the caller's viewport. [Canvas and clock](https://nothing.graphics/docs/format/spec#canvas-and-clock)

### `background` [#background]

**Value** `#RRGGBBAA` · **If omitted** `#00000000` · **Keys** Color channels

Fill the resolved viewport once beneath the artwork, using eight hexadecimal digits in RGBA order. [Canvas and clock](https://nothing.graphics/docs/format/spec#canvas-and-clock)

### `frame-rate` [#frame-rate]

**Value** `Positive integer or ratio of two positive integers in frames per second, such as 24 or 30000/1001` · **Keys** Static

Authored clock rate. Required if there is a placement or property track anywhere in the document. [Canvas and clock](https://nothing.graphics/docs/format/spec#canvas-and-clock)

### `camera` [#camera]

**Value** `Case-sensitive camera ID` · **Keys** Held

Choose the scene's base view. Required when the scene has camera declarations. With no cameras use the identity view. [2D cameras](https://nothing.graphics/docs/format/spec/spatial#cameras)

### `meters-per-unit` [#meters-per-unit]

**Value** meters per scene unit · **If omitted** `0.001` · **Keys** Static

Spatial trial. Positive metric scale for the spatial trial. [Proposed focus settings](https://github.com/gridaco/nothing/blob/main/ncf/rfcs/spatial-camera-focus.md#proposed-authoring-inputs)

## Children [#children]

| Elements                                                                                                                                                                                                      | Cardinality  | Declared by | Role and source order                                                                                                                                                                                                                                                                                                                                                                                      |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`<shape>`](https://nothing.graphics/docs/format/reference/shape), [`<group>`](https://nothing.graphics/docs/format/reference/group), [`<sequence>`](https://nothing.graphics/docs/format/reference/sequence) | Zero or more | `<scene>`   | Root drawables in a Level 1 scene. Document order from bottom to top.                                                                                                                                                                                                                                                                                                                                      |
| [`<camera>`](https://nothing.graphics/docs/format/reference/camera)                                                                                                                                           | Zero or more | `<scene>`   | Named cameras. Supply a base camera ID when any are present. Declarations occupy no paint slot. [2D cameras](https://nothing.graphics/docs/format/spec/spatial#cameras)                                                                                                                                                                                                                                    |
| [`<plane>`](https://nothing.graphics/docs/format/reference/plane)                                                                                                                                             | Zero or more | `<scene>`   | Spatial trial. Planes are the root drawables in a spatial trial scene. Depth order from far to near per ray. At equal depth the later plane paints over the earlier one. Use planes instead of direct Level 1 drawables with the spatial projection. [Proposed plane authoring and depth](https://github.com/gridaco/nothing/blob/main/ncf/rfcs/spatial-cameras.md#scene-integration--editable-2d-artwork) |
| [`<animate>`](https://nothing.graphics/docs/format/reference/animate)                                                                                                                                         | Zero or more | Animation   | A track targets one keyable property on this owner. For equal first-key times, the later track in document order wins. [Evaluating animation tracks](https://nothing.graphics/docs/format/spec/animation#evaluation)                                                                                                                                                                                       |

## Specifications [#specifications]

* [Complete document and source grammar](https://nothing.graphics/docs/format/spec#a-complete-document)
* [Source-preserving editing](https://nothing.graphics/docs/format/spec#source-preserving-editing)
* [Diagnostics and evidence](https://nothing.graphics/docs/format/spec#diagnostics-and-evidence)
* [Canvas and clock](https://nothing.graphics/docs/format/spec#canvas-and-clock)
* [2D cameras](https://nothing.graphics/docs/format/spec/spatial#cameras)
* [Proposed focus settings](https://github.com/gridaco/nothing/blob/main/ncf/rfcs/spatial-camera-focus.md#proposed-authoring-inputs)
* [Proposed plane authoring and depth](https://github.com/gridaco/nothing/blob/main/ncf/rfcs/spatial-cameras.md#scene-integration--editable-2d-artwork)
* [Evaluating animation tracks](https://nothing.graphics/docs/format/spec/animation#evaluation)
