EffectContext interface
Methods are bound, so `setup({ surface, u, place })` works.
import type { EffectContext } from '@dioramajs/diorama'interface EffectContext<P extends ParamSpec = ParamSpec>Members
| Name | Type | Description |
|---|---|---|
readonly app | EffectApp | Kernel scope of the instance: services, listeners and systems that die with it. |
readonly element | Element | The element the instance runs on. |
readonly input | EffectInput | Same object as |
readonly layer | Layer | The element's layer, shared by its effects. |
readonly map | Texture | The <img> or <video> as a texture, shared by all effects on the element. Needs |
readonly name | string | The effect's name, the token in |
readonly overlay | Group | Like |
readonly params | Readonly<ParamsOf<P>> | Live resolved values. Read them in |
readonly quality | QualityTier | The tier from |
readonly render | RenderApi | The renderer, scene and camera. |
readonly signal | AbortSignal | Aborted on dispose. |
readonly surface | Surface | The shared GL copy of the element, created on first access. |
readonly u | Uniforms<P> | Input uniforms and one uniform per live param, for TSL graphs. |
readonly viewport | Group | Group pinned to the viewport (centre 0,0, world px). It does not scroll with the element, ignores pose and hides while the layer is off screen. Use |
attach | | Attaches an effect owned by this instance. A selector resolves inside the element. |
compile | | Compiles the materials of |
coverUV | | Maps box UV to texture UV with the element's object-fit and object-position. Defaults to |
fit | | CSS object-fit and object-position for any texture, e.g. the images of children. |
invalidate | | Requests one frame if the layer is visible: from an event handler or a loaded resource. State that moves on over several frames asks from the update by returning true. |
layers | | Live layers of matching descendants in document order. The array updates in place. |
mask | | 0..1 alpha mask at box UV for own materials: contain bars, radius, overflow clip, opacity. |
model | | A glTF instance from the assets cache, clips in |
onDispose | | Runs |
place | | Glues an object to the box so it follows layout and pose. Disposed with the instance. |
pose | | Blends a layer from its layout towards |
raise | | Lifts the canvas above every element of the page, into the browser's top layer, until the returned Off runs or the phase closes. Calls are counted: the canvas comes down with the last Off. For full-screen views over sticky headers and chat widgets; a modal |
section | | The scroll section the element plays in: the closest |
set | | Writes params the way |
showDom | | true hands the picture to the DOM: this phase's |
texture | | A texture from the assets cache: shared, never dispose it. The lease dies with the phase. Needs |
Also exported from @dioramajs/diorama/auto, @dioramajs/diorama/effects, @dioramajs/effects.
Defined in packages/effects/src/types.ts.