Diorama

Made for a big screen.

This site is one 3D scene, built for a computer: a wide window and a mouse. Open dioramajs.dev on a desktop or a laptop to see it.This site is one 3D scene, built for a wide window. Make this one wider, or open dioramajs.dev on a larger screen.

GitHub

DioramaDocs

Copy interface

Control of one element's GL copy from outside its effects.

View as Markdown
import type { Copy } from '@dioramajs/diorama/effects'

Taken with leave: 'ghost', the copy is not parked or released when its element leaves the document. It becomes a ghost owned by the taker. Every write requests a frame. One owner per element.

interface Copy

Members

NameTypeDescription
abovenumber

Draw level over the page. Higher levels draw above lower ones, 0 is the page. Default 0. While a copy above 0 is drawn, a canvas under the page goes into the top layer, over the page.

boxBox | undefined

Draws at this viewport box instead of the element's. CSS opacity is not followed while set.

clipBox | undefined

Clips to this viewport box instead of the clipping ancestor's. Undefined keeps the ancestor's, frozen relative to the copy's box once the element left or while box is set.

cropCrop | undefined

Region of the picture to show instead of object-fit and the effects' surface.zoom, in texture UV (y up). Undefined follows them. Lets an owner move the framing smoothly during a flight.

readonly cssOpacitynumber

CSS opacity of the element and its ancestors as last read, 1 before the first read. Frozen for a ghost. Still read while box is set, but not applied.

readonly drawableboolean

Can be drawn now: compiled (placed objects too while veiled) and media ready.

readonly drawnDrawnBox | undefined

The last drawn frame, undefined if never drawn. Frozen for a ghost and while veiled.

readonly effectsreadonly string[]

In effect order.

readonly elementElement

The element whose copy this is.

leave'ghost' | 'release'

When the element leaves the document, 'ghost' keeps the copy as a ghost and 'release' lets the effects go the usual way (parked, then released) and releases this copy.

opacitynumber

Alpha multiplier 0..1. Default 1.

readonly posedPosedBox | undefined

Where the element's effects pose this copy (ctx.pose on its layer) as of the last frame, worked out from the element's box even while box holds the copy elsewhere, so an owner can let go of it there without a jump. Undefined while not posed, and for a ghost.

presencenumber

u.presence of the copy's effects, 0..1. Default 1.

radiusnumber | undefined

border-radius override in px. Undefined keeps the element's, frozen once it left.

readonly readyPromise<boolean>

Resolves true once drawable, false if it never will be (failed, off, unavailable, released, or no records after a reconcile that saw the element connected).

readonly sourcestring

currentSrc the texture shows, '' without media.

readonly stateCopyState

'none' means no drawable copy yet. 'ghost' means the element left and the copy lives on.

veilboolean

Hides both the copy and the DOM (data-dio-state="entering") while loading goes on.

cropAt
cropAt(box: Box): Crop | undefined

The region object-fit and the effects' surface.zoom show in this box, undefined until the picture size is known.

dispose
dispose(): void

Same as release, so a copy works as a kernel Cleanup.

release
release(): void

Idempotent. A connected element's copy goes back to its DOM life, a ghost is released.

Also exported from @dioramajs/effects.

Defined in packages/effects/src/types.ts.