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

Install with Nuxt

Add the Diorama module to Nuxt and start the app in a client plugin.

View as Markdown
On this page

The Nuxt module adds the Vite plugin with the effects folder under srcDir, which is app/effects/ in Nuxt 4.

Install the packages

Terminal window
npm install @dioramajs/diorama three
Terminal window
pnpm add @dioramajs/diorama three
Terminal window
yarn add @dioramajs/diorama three
Terminal window
bun add @dioramajs/diorama three

Add the module

nuxt.config.ts
export default
function defineNuxtConfig(
config: { modules: string[]; }
): unknown
defineNuxtConfig
({
modules: string[]
modules
: ['@dioramajs/diorama/nuxt'] })

Start the app in a client plugin

A plugin whose name ends in .client.ts runs in the browser only.

app/plugins/diorama.client.ts
import {
function start(options?: StartOptions): App

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

import { start } from '@dioramajs/diorama'
export const app = start()

start
} from '@dioramajs/diorama'
export default
function defineNuxtPlugin(setup: () => void): unknown
defineNuxtPlugin
(() => {
function start(options?: StartOptions): App

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

import { start } from '@dioramajs/diorama'
export const app = start()

start
()
})

Put an effect on an image

app/app.vue
<template>
<img
src="/cover.jpg"
width="800"
height="450"
data-dio="ripple"
/>
</template>

<NuxtPage> without a page transition swaps pages in one render, so keyed elements fly between pages without more code.