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/transitions

Exports of @dioramajs/diorama/transitions.

View as Markdown
On this page
import { cover, covered, coverPlugin } from '@dioramajs/diorama/transitions'

Functions

coverPreset with the `cover` plugin: the old page leaves and the new one arrives through a GL cover. Needs `effects` and works with the `transitions` preset, which tells it when the page changed.
coveredCloses the cover of `app` and resolves true once the page is covered, for routers that change the page from code: `await covered(app, event); router.push(href)`. Resolves false at once without the plugin, before the app runs, or when the cover can't play.
coverSettingsSplits flat options into the look's params and the timing.
linkOfThe link a plain click follows to another page of this site, if it is one.
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()]`.

Classes

TransitionErrorReported through `app.report` (the kernel wraps it as `REPORTED`) or logged in dev.

Constants

coverPluginProvides `app.cover`, a GL cover over the page while it changes.
transitionPluginProvides `app.transition`, page transitions that fly the GL copies of keyed elements.

Interfaces

CoverApiThe `cover` service.
CoverSettingsSettings of the `cover` plugin; `cover()` makes them from flat options.
CoverTimingTiming and behaviour shared by every cover.
CurtainCover`curtain`: a panel sweeps over the old page and on, off the new one.
CustomCoverYour own cover: an effect with a `position` param (0 page shown, 1 covered, 2 shown again), and optionally `x` and `y`, the origin in viewport fractions. It runs on `<html>`.
FlightEvery write requests a frame, so it can be tweened directly.
FlightOptionsHow copies fly between pages.
InkCover`ink`: a blot spreads from the clicked link over the page, then recedes off the new one.
PageScopeThe current page: a scope closed when the next page replaces it.
PixelCover`pixel`: the old page breaks into growing blocks and the new one resolves from them.
PresenceAn unpaired copy that leaves or a new copy that enters.
PresenceOptionsHow unpaired copies leave and new ones enter.
TransitionThenable. Resolves with the result and never rejects.
TransitionApiThe `transition` service: call it with a swap to fly copies between pages.
TransitionOptionsOptions of one `app.transition` call. Unset fields take the plugin options.
TransitionResultHow a transition ended.
TransitionsOptionsOptions of the `transitions` preset.

Types

CoverNameThe ready-made covers.
CoverOptionsA cover and its timing, e.g. `{ name: 'ink', color: '#e4002b', duration: 0.7 }`.
CoverOriginWhere a cover starts: a click, an element (its centre), or a viewport point in CSS px.
CoverStateWhere the cover is: the page shows, it closes, it hides the page, or it opens.
EaseAn easing function from 0..1 to 0..1.
FlightStateState of one flight.
SwapChanges the DOM. May return a thenable that settles once the router is done.
TransitionErrorCodeCodes of `TransitionError`.
TransitionPhasePhase of a transition: the swap runs, copies fly, or it is over.