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

GlslEffectOptions interface

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

View as Markdown
import type { GlslEffectOptions } from '@dioramajs/diorama/glsl'
interface GlslEffectOptions<P extends ParamSpec> extends Partial<Omit<EffectDefinition<P>, 'setup' | 'params' | 'name' | 'media'>>

Members

NameTypeDescription
readonly 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'.

readonly bleed?number

Extra px around the box for visibility, for copies displaced past it. Default 0.

readonly 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.

readonly colorSpace?'srgb' | 'linear'

Overrides the shader's colour space.

readonly functions?{ [name: string]: ShaderFunction }

Bodies for GLSL prototypes, written in TSL.

readonly 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.

readonly name?string

Default: the shader's name.

readonly on?string

Selector of the elements this effect accepts. Others are skipped with a warning.

readonly 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.

readonly quality?QualitySpec<P>

How the effect gets cheaper on weaker GPUs. Read by the runtime and by the docs.

readonly rebuild?readonly (keyof P & string)[]

Params whose change re-runs setup. String and choice params always do.

readonly reducedMotion?'static' | 'off'

'static' (default) runs with motion inputs zeroed and time frozen. 'off' skips the effect.

readonly textures?{ [uniform: string]: TextureSource }

Sources for texture: bindings. Each URL is loaded once and shared.

readonly uniforms?{ [uniform: string]: Binding | (ctx: EffectContext<P>) => Node }

Binding overrides, keyed by GLSL uniform name.

readonly 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.