Copy interface
Control of one element's GL copy from outside its effects.
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 CopyMembers
| Name | Type | Description |
|---|---|---|
above | number | 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. |
box | Box | undefined | Draws at this viewport box instead of the element's. CSS opacity is not followed while set. |
clip | Box | 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 |
crop | Crop | undefined | Region of the picture to show instead of object-fit and the effects' |
readonly cssOpacity | number | CSS opacity of the element and its ancestors as last read, 1 before the first read. Frozen for a ghost. Still read while |
readonly drawable | boolean | Can be drawn now: compiled (placed objects too while veiled) and media ready. |
readonly drawn | DrawnBox | undefined | The last drawn frame, undefined if never drawn. Frozen for a ghost and while veiled. |
readonly effects | readonly string[] | In effect order. |
readonly element | Element | 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. |
opacity | number | Alpha multiplier 0..1. Default 1. |
readonly posed | PosedBox | undefined | Where the element's effects pose this copy ( |
presence | number |
|
radius | number | undefined | border-radius override in px. Undefined keeps the element's, frozen once it left. |
readonly ready | Promise<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 source | string |
|
readonly state | CopyState | 'none' means no drawable copy yet. 'ghost' means the element left and the copy lives on. |
veil | boolean | Hides both the copy and the DOM ( |
cropAt | | The region object-fit and the effects' |
dispose | | Same as release, so a copy works as a kernel |
release | | 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.