# GlslEffectOptions

interface in `@dioramajs/diorama/glsl`

```ts
import type { GlslEffectOptions } from '@dioramajs/diorama/glsl'
```

Options of `glslEffect`: definition fields plus how uniforms are bound.

```ts
interface GlslEffectOptions<P extends ParamSpec> extends Partial<Omit<EffectDefinition<P>, 'setup' | 'params' | 'name' | 'media'>>
```

## Members

| Name | Type | Description |
| --- | --- | --- |
| `animate?` | `AnimatePolicy<P>` | Defaults to the update's answer when it returns a boolean, else to what the effect reads: `time` animates every visible frame, `hoverTime` while hovered or hover decays, neither means 'input'. |
| `bleed?` | `number` | Extra px around the box for visibility, for copies displaced past it. Default 0. |
| `burst?` | `boolean` | Objects in `ctx.overlay` outlive a hidden or removed element while the effect still asks for frames itself (a burst): its update returned true, or its `animate` function says so. false ties them to the element: a pane or a layer of the page that only animates its state. Default true. |
| `colorSpace?` | `'srgb' \| 'linear'` | Overrides the shader's colour space. |
| `functions?` | `{ [name: string]: ShaderFunction }` | Bodies for GLSL prototypes, written in TSL. |
| `mode?` | `'surface' \| 'plane'` | `surface` draws on the element's GL copy and stacks with other effects. `plane` adds a plane over the box. Defaults to `surface` when the shader reads the element's image. |
| `name?` | `string` | Default: the shader's name. |
| `on?` | `string` | Selector of the elements this effect accepts. Others are skipped with a warning. |
| `presence?` | `'fade' \| 'custom'` | Page transitions. 'fade' (default) multiplies the copy's alpha by `u.presence`. With 'custom' the effect reads `u.presence` or `input.presence` itself. |
| `quality?` | `QualitySpec<P>` | How the effect gets cheaper on weaker GPUs. Read by the runtime and by the docs. |
| `rebuild?` | `readonly (keyof P & string)[]` | Params whose change re-runs setup. String and choice params always do. |
| `reducedMotion?` | `'static' \| 'off'` | 'static' (default) runs with motion inputs zeroed and time frozen. 'off' skips the effect. |
| `textures?` | `{ [uniform: string]: TextureSource }` | Sources for `texture:` bindings. Each URL is loaded once and shared. |
| `uniforms?` | `{ [uniform: string]: Binding \| (ctx: EffectContext<P>) => Node }` | Binding overrides, keyed by GLSL uniform name. |
| `when?` | `When` | Media query the page must match or the instance is `off`. 'hover' means '(hover: hover)'. |
| `setup?` | `setup(ctx: EffectContext<P>): void \| EffectUpdate \| Promise<void \| EffectUpdate>` | Runs after the shader is bound. May return a per-frame update. |

Also exported from `@dioramajs/glsl`.

Defined in [packages/glsl/src/runtime.ts](https://github.com/MasterKurosava/diorama/blob/main/packages/glsl/src/runtime.ts#L90).
