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.
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
npminstall@dioramajs/dioramathree
Terminal window
pnpmadd@dioramajs/dioramathree
Terminal window
yarnadd@dioramajs/dioramathree
Terminal window
bunadd@dioramajs/dioramathree
Add the module
nuxt.config.ts
exportdefault
functiondefineNuxtConfig(
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{
functionstart(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'
exportdefault
functiondefineNuxtPlugin(setup:()=>void):unknown
defineNuxtPlugin(()=>{
functionstart(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.