# @dioramajs/diorama/effects

Exports of @dioramajs/diorama/effects.

## Functions and values

- [attachPlugin](/docs/api/diorama-effects/attach-plugin.md): `app.attach`, the same function as `app.effects.attach`.
- [color](/docs/api/diorama/color.md): Colour param. A CSS colour string on the CPU, as written; a `color` uniform on the GPU. The uniform reads `var(--name)` and `currentColor` from the element when the value is written and again in every frame the element draws, so a theme switch shows with the next frame. Code that reads the string itself resolves it with `cssColor(value, element)` of `@dioramajs/render`.
- [defineEffect](/docs/api/diorama/define-effect.md): Checks a definition and returns it as a frozen callable. Registers and loads nothing. Throws `EFFECT_DEFINITION` on a bad definition.
- [effect](/docs/api/diorama/effect.md): Short form of `defineEffect`: defaults, optional options, setup. An unnamed effect takes its registry key (the file name when a build plugin finds it).
- [EffectError](/docs/api/diorama-effects/effect-error.md): Goes through `app.report`, which wraps it as `REPORTED` with this as `cause`. `instanceof EffectError` checks the name, so it also holds for definition errors thrown by `@dioramajs/effects/effect`, which cannot import this class, and across two copies.
- [effects](/docs/api/diorama/effects.md): Preset of the `effects` and `attach` plugins.
- [effectsPlugin](/docs/api/diorama-effects/effects-plugin.md): Effects from markup and code. This light part loads the runtime when needed.
- [group](/docs/api/diorama-effects/group.md): Entries of a package whose map loads on first need: one entry per name, each sharing the loader, with `extra` fields that must be known before the map, such as `intro`.
- [oneOf](/docs/api/diorama/one-of.md): String param limited to these values. The first one is the default.
- [redefine](/docs/api/diorama/redefine.md): Swaps the definition registered under `key` in live apps.
- [text](/docs/api/diorama/text.md): Plain string param for a default that looks like a colour, e.g. `text('#cafe')`.

## Types

- [AnimatePolicy](/docs/api/diorama-effects/types/animate-policy.md): When an effect asks for frames beyond input and its update's answer: - 'input' (default): frames only on input (scroll, pointer, resize, param writes). - 'hover': also while hovered or hover decays. - 'visible': every frame while on screen. - a function: checked after update, true requests the next frame. The runtime also asks it between frames whether a burst in `ctx.overlay` still flies, which an update's answer cannot tell before the next frame (a click that starts a burst and hides its element). - `{ fps }`: time frames at most `fps` a second while visible, 0 means none. Input frames run at full rate.
- [AnyParamValue](/docs/api/diorama-effects/types/any-param-value.md): Any param value.
- [Attach](/docs/api/diorama-effects/types/attach.md): `app.attach`: puts an effect on elements by selector, element or list.
- [AttachOptions](/docs/api/diorama-effects/types/attach-options.md): Options of `attach`.
- [AttachPlugin](/docs/api/diorama-effects/types/attach-plugin.md): The `attach` plugin, which gives `app.attach`.
- [Box](/docs/api/diorama-effects/types/box.md): A viewport box in CSS px, as anchors report it.
- [CheckParams](/docs/api/diorama-effects/types/check-params.md): Makes reserved param names fail in `defineEffect`.
- [CheckSpec](/docs/api/diorama-effects/types/check-spec.md): Makes reserved names fail at the call site.
- [ChildDoc](/docs/api/diorama-effects/types/child-doc.md): What the effect reads from or drives in the element's children, not a param: an attribute (`{ attribute: 'data-dio-src' }`) or a child element (`{ element: 'input[type="range"]' }`).
- [ChoiceParam](/docs/api/diorama/types/choice-param.md): A string param limited to some values, made by `oneOf()`.
- [ColorParam](/docs/api/diorama/types/color-param.md): A colour param, made by `color()`. Its uniform reads `var(--name)` and `currentColor` from the element, again in every frame the element draws, so it follows a theme switch.
- [Copy](/docs/api/diorama-effects/types/copy.md): Control of one element's GL copy from outside its 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.
- [CopyState](/docs/api/diorama-effects/types/copy-state.md): The state of a taken copy.
- [Crop](/docs/api/diorama-effects/types/crop.md): A region of a picture in texture UV, y up: `texture uv = box uv * size + xy`.
- [DocExample](/docs/api/diorama-effects/types/doc-example.md): An example of an effect's docs: markup and optional code.
- [DrawnBox](/docs/api/diorama-effects/types/drawn-box.md): What the copy showed in its last drawn frame, in viewport CSS px.
- [Effect](/docs/api/diorama/types/effect.md): Frozen callable, like a plugin. Calling it returns a configured use.
- [EffectApp](/docs/api/diorama-effects/types/effect-app.md): Kernel scope of one instance. Registrations die with it. Exposes the services effects use, plus `assets` when `@dioramajs/assets` is installed.
- [EffectCategory](/docs/api/diorama-effects/types/effect-category.md): A group of the docs site's effect gallery, named by what the reader wants to animate. An effect has one primary group (`category`) and may show in others (`tags`).
- [EffectContext](/docs/api/diorama/types/effect-context.md): Methods are bound, so `setup({ surface, u, place })` works.
- [EffectDefinition](/docs/api/diorama-effects/types/effect-definition.md): What `defineEffect` takes: the params, the options and `setup`.
- [EffectDoc](/docs/api/diorama-effects/types/effect-doc.md): The written part of an effect's docs, typed against the effect so every param is described.
- [EffectEntries](/docs/api/diorama/types/effect-entries.md): The key is the token in markup and the instance name. A definition with another name is an alias.
- [EffectEntry](/docs/api/diorama-effects/types/effect-entry.md): A loader plus what the light part must know before three loads. Checked against the definition after load. On a mismatch the definition wins and dev mode warns.
- [EffectErrorCode](/docs/api/diorama-effects/types/effect-error-code.md): Codes of `EffectError`.
- [EffectGroup](/docs/api/diorama-effects/types/effect-group.md): The shared loader of a package's entry map; see `group()`.
- [EffectGroupEntry](/docs/api/diorama-effects/types/effect-group-entry.md): An entry whose metadata comes with its package's map, loaded on first need. Its own fields lie over the map's entry, like a site's patch.
- [EffectHandle](/docs/api/diorama/types/effect-handle.md): Calling the handle detaches it, like kernel handles. `scope.onDispose(handle)` ties it to a scope.
- [EffectInput](/docs/api/diorama-effects/types/effect-input.md): The same inputs as numbers. One object per layer, updated in place in `layout`.
- [EffectInstance](/docs/api/diorama-effects/types/effect-instance.md): Stable facade of an (element, name) pair. The same object, with its runtime writes, survives park, dispose and re-creation for the same pair (Vue KeepAlive, cached nodes).
- [EffectLoader](/docs/api/diorama-effects/types/effect-loader.md): A lazy import of an effect module.
- [EffectMeta](/docs/api/diorama-effects/types/effect-meta.md): One effect in `meta.json`: what the definition says plus its `.doc.ts`.
- [EffectModule](/docs/api/diorama-effects/types/effect-module.md): A module whose default export is an effect, or the effect itself.
- [EffectName](/docs/api/diorama/types/effect-name.md): Checked once a registry is extended, any string before that.
- [EffectOptions](/docs/api/diorama/types/effect-options.md): Options of `effect()`, the definition minus params and setup.
- [EffectsApi](/docs/api/diorama-effects/types/effects-api.md): The `effects` service, `app.effects`.
- [EffectSetup](/docs/api/diorama/types/effect-setup.md): The `setup` function of an effect.
- [EffectsOptions](/docs/api/diorama-effects/types/effects-options.md): Options of the `effects` preset.
- [EffectSource](/docs/api/diorama-effects/types/effect-source.md): An effect, a loader, an entry with metadata or an entry of a lazy group.
- [EffectsPlugin](/docs/api/diorama-effects/types/effects-plugin.md): The `effects` plugin.
- [EffectsStats](/docs/api/diorama-effects/types/effects-stats.md): Counters of `app.effects.stats()`.
- [EffectsStatus](/docs/api/diorama-effects/types/effects-status.md): The state of the engine.
- [EffectTypes](/docs/api/diorama/types/effect-types.md): Effect types of packages by name, for typed attach and get. Extend via declaration merging.
- [EffectUpdate](/docs/api/diorama-effects/types/effect-update.md): Runs every frame while the instance is running and visible. Return `true` to ask for the next frame while state kept in JavaScript still moves (a damped value, a fade, a simulation), and `false` once it has settled. Without an `animate` option a returned boolean decides alone, so reading `input.delta` for the motion does not draw every frame; return one on every path. With `animate`, `true` adds frames to the policy. Returning nothing leaves it to the policy. `true` is honoured under reduced motion too: settle at once when `input.reducedMotion` is set.
- [EffectUse](/docs/api/diorama-effects/types/effect-use.md): An effect with params, as `ripple({ strength: 2 })` returns it.
- [EventDoc](/docs/api/diorama-effects/types/event-doc.md): A DOM event an effect dispatches on its element.
- [Fit](/docs/api/diorama-effects/types/fit.md): A texture framed in the element's box like CSS object-fit.
- [FitOptions](/docs/api/diorama-effects/types/fit-options.md): Options of `ctx.fit`.
- [InputUniforms](/docs/api/diorama-effects/types/input-uniforms.md): Built-in inputs as TSL uniforms. Each one is created on first access and only then updated.
- [InstanceStatus](/docs/api/diorama-effects/types/instance-status.md): Where an instance is in its life.
- [Layer](/docs/api/diorama-effects/types/layer.md): One per element with at least one live effect.
- [LiveParams](/docs/api/diorama-effects/types/live-params.md): Writable params of handles and instances. Tuples read as live vectors you can tween by component. Write a whole tuple with `set({ offset: [1, 2] })`.
- [ModelOptions](/docs/api/diorama-effects/types/model-options.md): Options of `ctx.model`.
- [OptionName](/docs/api/diorama-effects/types/option-name.md): Definition options, never valid as param names: `effect({ when: 'hover' }, setup)` fails.
- [ParamDefault](/docs/api/diorama-effects/types/param-default.md): A param default: its type is the param type. The string 'auto' makes a number param that may also be 'auto': the effect picks the value itself. It has no uniform, so a change rebuilds.
- [ParamDoc](/docs/api/diorama-effects/types/param-doc.md): Description of one param in an effect's `.doc.ts`.
- [ParamMeta](/docs/api/diorama-effects/types/param-meta.md): One param in `meta.json`.
- [ParamsOf](/docs/api/diorama-effects/types/params-of.md): Param values by name.
- [ParamSpec](/docs/api/diorama-effects/types/param-spec.md): Param defaults by name.
- [ParamUniform](/docs/api/diorama-effects/types/param-uniform.md): The uniform node of a param with default `D`; strings and choices have none.
- [ParamValue](/docs/api/diorama-effects/types/param-value.md): The value type of a param with default `D`.
- [ParamVector](/docs/api/diorama-effects/types/param-vector.md): Live view of a tuple param. Each component can be tweened.
- [PartDoc](/docs/api/diorama-effects/types/part-doc.md): A shadow part of the effect's own UI, styled by the site with `::part()`.
- [PlaceOptions](/docs/api/diorama-effects/types/place-options.md): Options of `ctx.place`.
- [PosedBox](/docs/api/diorama-effects/types/posed-box.md): Where the element's own effects pose its copy, in viewport CSS px.
- [PoseTarget](/docs/api/diorama-effects/types/pose-target.md): Absolute target in world px (viewport centre 0,0, y up) and radians. Omitted fields keep layout.
- [QualityCaps](/docs/api/diorama-effects/types/quality-caps.md): Upper bounds of numeric params at a tier. A value above the bound is lowered, never raised.
- [QualitySpec](/docs/api/diorama-effects/types/quality-spec.md): How an effect gets cheaper: the lowest tier it runs at and its caps per tier.
- [QualityTier](/docs/api/diorama-effects/types/quality-tier.md): Quality tier, from `@dioramajs/quality`.
- [ReleaseRequest](/docs/api/diorama-effects/types/release-request.md): Payload of `effects:release`: a drawn copy's element left the document and nobody took it.
- [ReservedAttr](/docs/api/diorama-effects/types/reserved-attr.md): `data-dio-*` names used by the framework itself.
- [ReservedParam](/docs/api/diorama-effects/types/reserved-param.md): Names a param cannot take: input uniforms (they share `ctx.u`) and reserved attributes. `EffectInput` keys are fine because inputs live on `ctx.input`.
- [SiteEffects](/docs/api/diorama/types/site-effects.md): Effect types of the site's own files, written by the build plugin. A site file named like a package effect (`ripple.ts`) overrides its type instead of conflicting with it.
- [SpecFor](/docs/api/diorama-effects/types/spec-for.md): The params of a known effect by name, `ParamSpec` for any other.
- [Surface](/docs/api/diorama-effects/types/surface.md): The element's single GL copy. Effects add transforms in the order they sit on the element.
- [SurfaceInput](/docs/api/diorama-effects/types/surface-input.md): Input of a colour transform. The final alpha is then multiplied by `u.opacity` and the clip mask.
- [TakeOptions](/docs/api/diorama-effects/types/take-options.md): Options of `app.effects.take`.
- [Target](/docs/api/diorama-effects/types/target.md): A selector is a live rule, like a CSS rule. An element or a list is a fixed set, held weakly.
- [TextParam](/docs/api/diorama-effects/types/text-param.md): A plain string param whose default looks like a colour, e.g. `text('#cafe')`.
- [TextureOptions](/docs/api/diorama-effects/types/texture-options.md): Options of `ctx.texture`.
- [Uniforms](/docs/api/diorama-effects/types/uniforms.md): `ctx.u`: the input uniforms and one uniform per live param.
- [When](/docs/api/diorama-effects/types/when.md): A media query. 'hover' is short for '(hover: hover)'.
- [WidenSpec](/docs/api/diorama-effects/types/widen-spec.md): Widens literal defaults so `Effect<{ strength: number }>` accepts `{ strength: 1 }`.
