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.
Explained in The screen layer.
screen
TypeScript
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'sstagehas it.options:underdraws 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
TypeScript
type Anchor =
| "center"
| "top"
| "bottom"
| "left"
| "right"
| "top left"
| "top right"
| "bottom left"
| "bottom right"
ScreenLayer
TypeScript
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]
}