# Reference: framescript/screen

What a scene imports from `framescript/screen` and calls, in the order the module exports it. Each entry has its signature, what it does, and the examples that use it; the types its signatures name are [at the end](#types).

Explained in [The screen layer](/docs/framework/scene/screen.md).

## `screen`

```ts
function screen(
  size: {
    readonly width: number
    readonly height: number
  },
  options?: {
    readonly under?: boolean
  }
): ScreenLayer
```

Makes a layer on the screen, to pass to `add`. Things added with the layer as their parent are laid out in the scene's pixels and stay where they are put whatever the camera does: a title, a logo, a watermark, a window, a fade to black.

- `size`: The scene's size: the timeline's `stage` has it.
- `options`: `under` draws the layer before the scene's effects, so that a grain or a vignette lies over it too.
- Returns: The layer.

Examples: camera/along, camera/orbit, camera/dolly-zoom

## Types

### `Anchor`

```ts
type Anchor =
  | "center"
  | "top"
  | "bottom"
  | "left"
  | "right"
  | "top left"
  | "top right"
  | "bottom left"
  | "bottom right"
```

### `ScreenLayer`

```ts
class ScreenLayer extends THREE.Group {
  readonly width: number
  readonly height: number
  readonly under: boolean
  /** Marks the layer for whatever draws the scene. */
  readonly framescriptScreen = true
  /**
   * @param width - The scene's width, in pixels.
   * @param height - The scene's height, in pixels.
   * @param under - Whether the layer is drawn before the scene's effects,
   *   so that they reach it, instead of after them.
   */
  constructor(width: number, height: number, under?: boolean)
  /**
   * A place on the layer, measured from an edge, a corner or the middle.
   *
   * @param anchor - Where to measure from.
   * @param x - Pixels inwards from a left or right edge; from the middle,
   *   pixels to the right.
   * @param y - Pixels inwards from a top or bottom edge; from the middle,
   *   pixels up.
   * @returns The position, to give to `add` or a tween.
   */
  at(anchor: Anchor, x?: number, y?: number): [x: number, y: number, z: number]
}
```
