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

@dioramajs/diorama/auto

The no-build entry served from a CDN; it starts on its own.

View as Markdown
On this page
import { assets, color, createApp } from '@dioramajs/diorama/auto'

Functions

colorColour 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`.
createAppCreates an app with the built-in web layer and the given presets and plugins. Call `start()` to run it.
defineEffectChecks a definition and returns it as a frozen callable. Registers and loads nothing. Throws `EFFECT_DEFINITION` on a bad definition.
effectShort form of `defineEffect`: defaults, optional options, setup. An unnamed effect takes its registry key (the file name when a build plugin finds it).
effectsPreset of the `effects` and `attach` plugins.
oneOfString param limited to these values. The first one is the default.
readyResolves with the app once it runs: the page's app of `start()` by default, waiting for the call if it has not happened yet. Rejects if the app fails or is destroyed first.
redefineSwaps the definition registered under `key` in live apps.
startStarts Diorama on the page and returns the app at once. It finishes starting in the background. A second call returns the same app, so a re-run module doesn't make another.
textPlain string param for a default that looks like a colour, e.g. `text('#cafe')`.
transitionCalls `app.transition` if the plugin is running, otherwise runs `swap` once and returns a settled 'skipped' transition. Safe for routers that navigate before `app.start()` resolves.
transitionsPreset with the `transition` plugin, e.g. `presets: [effects(), transitions()]`.

Constants

assets`app.assets`. One cache with leases for media and models, a priority queue, preloading of the next page and the progress wave of a preloader.
stageOne canvas for the whole site. It outlives page transitions.

Interfaces

ChoiceParamA string param limited to some values, made by `oneOf()`.
ColorParamA 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.
EffectFrozen callable, like a plugin. Calling it returns a configured use.
EffectContextMethods are bound, so `setup({ surface, u, place })` works.
EffectHandleCalling the handle detaches it, like kernel handles. `scope.onDispose(handle)` ties it to a scope.
EffectTypesEffect types of packages by name, for typed attach and get. Extend via declaration merging.
EntryPatchA known effect changed without its code: `{ ripple: { when: 'all' } }`. Both fields beat the definition's, and the light part reads them before the module loads.
SiteEffectsEffect 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.
StartOptionsOptions of `start()`. Every field is optional.

Types

AppWhat `createApp` returns: the kernel API, lifecycle controls and services.
EffectEntriesThe key is the token in markup and the instance name. A definition with another name is an alias.
EffectNameChecked once a registry is extended, any string before that.
EffectOptionsOptions of `effect()`, the definition minus params and setup.
EffectSetupThe `setup` function of an effect.