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.
This guide builds torch, a soft light that follows the pointer over an image and magnifies what is under it. Each step adds one part of the effect API, and the whole file is at the end. The later steps leave the torch and show what an effect can do beyond the picture of its element. For a finished light that follows the pointer, use the built-in spotlight.
Create the file
An effect is a file in the effects folder that exports effect(): src/effects/ with Vite, Astro and Next.js, app/effects/ with Nuxt. The file name is the effect name, so torch.ts is the token torch in data-dio. A file named after a built-in effect replaces the built-in, and development builds warn with EFFECT_OVERRIDE.
src/effects/torch.ts
import{
functioneffect(
setup:EffectSetup<Empty>
):Effect<Empty>(+2overloads)
Short form of defineEffect: defaults, optional options, setup. An unnamed effect takes its
registry key (the file name when a build plugin finds it).
Param names are lowerCamelCase. Input names (time, hover, pointer and the rest) and option names (when, animate, media and the rest) are taken: the type check and EFFECT_DEFINITION both name the clash.
The setup function gets the effect context. Its methods are bound, so you can destructure what you need. The next steps fill it in.
Light the picture
surface is the element’s picture as a plane on the canvas. surface.color() takes a function that gets the current color and returns a new one, written in TSL, the node language of three.js. u holds the params as uniforms (u.radius, u.tint) and the built-in inputs (u.pointer, u.hover, u.size).
src/effects/torch.ts
import{
functioneffect(
setup:EffectSetup<Empty>
):Effect<Empty>(+2overloads)
Short form of defineEffect: defaults, optional options, setup. An unnamed effect takes its
registry key (the file name when a build plugin finds it).
Input uniforms and one uniform per live param, for TSL graphs.
u.
tint: UniformNode<"color">
tint.
ColorExtensions.mul: (
b: Number<"float">
)=> Node<"vec3">
mul(
const light:Node<"float">
light)),
color: Node<"vec4">
color.
Swizzle1From4<"float">.a: Node<"float">
a)
})
},
)
uv is the box UV, 0 to 1 with y up. u.pointer uses the same space, so the distance between them is a distance in the box.
u.size is the box size in CSS pixels. Multiplying by the aspect ratio keeps the light round on a wide image.
u.hover rises from 0 to 1 while the pointer is over the element and falls back when it leaves, so the light fades in and out.
On an <img> or <video> the surface prepares the picture itself, crops it like CSS object-fit and object-position, and applies border-radius, the clip of an ancestor with overflow: hidden and the CSS opacity of the element. Once the plane is drawn, the element gets data-dio-state="drawn" and its DOM picture is hidden with filter: opacity(0). Layout, clicks, focus and alt stay with the element.
Live preview needs WebGPU or WebGL 2. A photo with the torch effect: a warm light follows the pointer and fades out when it leaves.
A param is an attribute named data-dio- plus the param name in kebab case.
index.html
<img
src="/cover.jpg"
data-dio="torch"
data-dio-radius="0.5"
data-dio-tint="#9ad7ff"
/>
Numbers, booleans, colors and tuples are uniforms, so a new attribute value changes the uniform and draws one frame. A color also takes var(--brand) and currentColor, read from the element’s computed style when it is set and again in every frame the element draws, so it follows a theme switch from the next frame. A switch made while nothing draws shows after app.invalidate(). Writes from code work the same way and beat attributes: app.attach('.hero', 'torch', { radius: 0.5 }) returns a handle, and handle.params.radius = 0.4 draws in the next frame. The build plugin writes the types of your effects to src/diorama.gen.d.ts, so the name and the params are checked.
Choose when it draws
Diorama draws a frame only when something changed. An effect that reads no clock draws when the page scrolls, when the pointer moves over it and when a param changes. Inputs that fade, such as hover and velocity, keep frames coming until they settle. torch reads u.pointer and u.hover only, so a page at rest draws nothing.
Reading a clock changes this. Read u.time and the effect draws every frame while it is on screen. Read u.hoverTime, seconds that run only while the pointer is over the element and while hover fades, and it draws only then.
src/effects/torch.ts
import{
functioneffect(
setup:EffectSetup<Empty>
):Effect<Empty>(+2overloads)
Short form of defineEffect: defaults, optional options, setup. An unnamed effect takes its
registry key (the file name when a build plugin finds it).
Input uniforms and one uniform per live param, for TSL graphs.
u.
tint: UniformNode<"color">
tint.
ColorExtensions.mul: (
b: Number<"float">
)=> Node<"vec3">
mul(
const light:Node<"float">
light)),
color: Node<"vec4">
color.
Swizzle1From4<"float">.a: Node<"float">
a)
})
},
)
To choose yourself, pass options between the params and the setup function. animate is the frame policy.
animate
Asks for frames
'input'
Never. Frames come from scroll, pointer and param changes
'hover'
While the pointer is over the element and while hover fades
'visible'
Every frame while the element is on screen
(ctx) => boolean
While the function returns true, checked after each frame
{ fps: 12 }
Time frames at most 12 times a second; input frames run at full rate
The update function can also answer for itself: returning true asks for the next frame and false for none, which suits state kept in JavaScript, such as a damped position. Without animate the answer decides alone; with it, true adds frames to the policy.
An effect never asks for frames while its element is off screen or the tab is hidden. Under reduced motion 'hover' and 'visible' ask for none, as Reduced motion explains. An update that returns true still gets its frames there, so let it settle at once when input.reducedMotion is set.
Skip touch devices
The torch needs a pointer that hovers. when takes a media query, and 'hover' is short for '(hover: hover)'. Where the query does not match, the instance is off, the element stays plain HTML and the engine does not start for it.
src/effects/torch.ts
import{
functioneffect(
setup:EffectSetup<Empty>
):Effect<Empty>(+2overloads)
Short form of defineEffect: defaults, optional options, setup. An unnamed effect takes its
registry key (the file name when a build plugin finds it).
Input uniforms and one uniform per live param, for TSL graphs.
u.
tint: UniformNode<"color">
tint.
ColorExtensions.mul: (
b: Number<"float">
)=> Node<"vec3">
mul(
const light:Node<"float">
light)),
color: Node<"vec4">
color.
Swizzle1From4<"float">.a: Node<"float">
a)
})
},
)
Diorama never guesses when: an effect that reacts to a tap can be what you want, so the choice is yours.
Magnify under the pointer
surface.uv() moves the point the picture is read from. It runs before every color function, so color in surface.color() already shows the bent picture. Add a zoom param and pull the UV toward the pointer inside the light.
src/effects/torch.ts
import{
functioneffect(
setup:EffectSetup<Empty>
):Effect<Empty>(+2overloads)
Short form of defineEffect: defaults, optional options, setup. An unnamed effect takes its
registry key (the file name when a build plugin finds it).
Input uniforms and one uniform per live param, for TSL graphs.
u.
tint: UniformNode<"color">
tint.
ColorExtensions.mul: (
b: Number<"float">
)=> Node<"vec3">
mul(
const light:Node<"float">
light)),
color: Node<"vec4">
color.
Swizzle1From4<"float">.a: Node<"float">
a)
})
},
)
The second argument of the color function also has box, the UV before any uv function, and sample(uv), which reads the picture at any UV with the crop and masks applied. A point outside the box reads the nearest edge pixel, like ClampToEdgeWrapping.
surface.position() moves the vertices of the plane. x and y are fractions of the box from -0.5 to 0.5, z is in CSS pixels toward the viewer. Ask for more vertices with surface.segments(); the largest request of all effects on the element wins.
src/effects/lift.ts
import{
functioneffect(
setup:EffectSetup<Empty>
):Effect<Empty>(+2overloads)
Short form of defineEffect: defaults, optional options, setup. An unnamed effect takes its
registry key (the file name when a build plugin finds it).
Input uniforms and one uniform per live param, for TSL graphs.
u.
InputUniforms.hover: UniformNode<"float">
Damped 0..1 while the pointer is over the box. 0 under reduced motion.
hover,
u: Uniforms<ColorsIn<{
readonly height:40;
}>>
Input uniforms and one uniform per live param, for TSL graphs.
u.
height: UniformNode<"float">
height)))
})
})
Put more than one effect on an element
List several names in data-dio. Every element has one picture, and its effects share it in the order of the tokens: each uv function gets the UV of the one before, each color function gets the color of the one before.
index.html
<img
src="/cover.jpg"
data-dio="ripple torch"
data-dio-radius="0.5"
data-dio-torch-strength="0.8"
/>
data-dio-radius is short: only torch has a radius.
ripple and torch both have a strength, so the short data-dio-strength applies to neither and a development build warns. Name the effect: data-dio-torch-strength.
An effect runs once per element. Markup, app.attach() and a parent’s ctx.attach() with the same name on the same element share one instance.
Changing the order of the tokens rebuilds the material without running setup again.
Draw your own objects
The surface is one option. Any three.js object works through the context, and Diorama keeps it on the element and disposes it with the instance.
place(object, options) glues an object to the element’s box and returns it. With fit: 'box', the default, a 1 by 1 object is stretched to the box; 'contain' scales it by the smaller side, and 'none' keeps pixel units.
viewport is a group pinned to the viewport: its origin is the center of the screen, its units are pixels, and it does not scroll with the page. Use it for the background of a sticky section.
update, the function setup returns, runs in every drawn frame while the element is on screen. It gets input, the inputs as numbers, and the frame time.
src/effects/halo.ts
import{
functioneffect(
setup:EffectSetup<Empty>
):Effect<Empty>(+2overloads)
Short form of defineEffect: defaults, optional options, setup. An unnamed effect takes its
registry key (the file name when a build plugin finds it).
Input uniforms and one uniform per live param, for TSL graphs.
u})=>{
const
const material:MeshBasicNodeMaterial
material=new
newMeshBasicNodeMaterial(
parameters?: MeshBasicNodeMaterialParameters
): MeshBasicNodeMaterial
Constructs a new mesh basic node material.
@param ― parameters - The configuration parameter.
MeshBasicNodeMaterial({
transparent?: boolean |undefined
Defines whether this material is transparent. This has an effect on
rendering as transparent objects need special treatment and are rendered
after non-transparent objects.
When set to true, the extent to which the material is transparent is
controlled by
Material#opacity
.
@default ― false
transparent:true})
const material:MeshBasicNodeMaterial
material.
NodeMaterialNodeProperties.colorNode:
| Node<"float">
| Node<"vec2">
| Node<"vec3">
| Node<"vec4">
| Node<"color">
|null
The diffuse color of node materials is by default inferred from the
color and map properties. This node property allows to overwrite the default
and define the diffuse color with a node instead.
material.colorNode=color(0xff0000);// define red color
If you don't want to overwrite the diffuse color but modify the existing
values instead, use
materialColor
.
material.colorNode= materialColor.mul(color(0xff0000));// give diffuse colors a red tint
Live resolved values. Read them in update, a read in setup is a snapshot.
params.
speed: number
speed
}
},
)
Reading input.time or input.delta in update counts as a clock, so halo draws every frame while it is visible. An effect that only eases toward the pointer reads delta too: its update returns true while it still moves and false once it settles, and the answer decides in place of the clock, as the 10-minute tutorial shows. Read params in update or through u: a value read from params in setup is a snapshot of that moment.
Diorama disposes the geometry, materials and textures of placed objects with the instance. Pass { dispose: false } for shared ones, and hand textures and render targets that live inside TSL nodes to onDispose. signal aborts when the instance goes away, for fetch and other async work in setup. Setup may be async: the element shows its DOM until the promise settles.
Folded from one sheet
A paper lantern, cut and creased by hand.
Live preview needs WebGPU or WebGL 2. A round card with the halo effect: a thin three-quarter ring turns around it while it is on screen.
const material =newMeshBasicNodeMaterial({transparent:true})
material.colorNode= u.color
// Three quarters of a ring, so the turn shows.
const geometry =newRingGeometry(
0.46,
0.5,
64,
1,
0,
Math.PI *1.5,
)
const ring =place(newMesh(geometry, material))
return(input)=>{
ring.rotation.z= input.time* params.speed
}
},
)
Read the element’s picture yourself
With media: true the picture is ready before setup, and map is its texture. coverUV(uv) maps box UV to texture UV with the element’s object-fit, and mask(uv) is the alpha of radius, clip and CSS opacity. place(mesh, { replace: true }) makes your mesh the element’s picture instead of the surface.
src/effects/drift.ts
import{
functioneffect(
setup:EffectSetup<Empty>
):Effect<Empty>(+2overloads)
Short form of defineEffect: defaults, optional options, setup. An unnamed effect takes its
registry key (the file name when a build plugin finds it).
Needs the or as a texture. Implies on: 'img, video', ready before setup.
'optional' reads it when the element is one and runs without it on other elements.
media:true},
({
map: Texture<unknown, TextureEventMap>
The or as a texture, shared by all effects on the element. Needs media: true.
map,
coverUV:(uv?:Node<"vec2">)=> Node<"vec2">
Maps box UV to texture UV with the element's object-fit and object-position. Defaults to uv().
coverUV,
mask:(uv?:Node<"vec2">)=> Node<"float">
0..1 alpha mask at box UV for own materials: contain bars, radius, overflow clip, opacity.
mask,
place:<TextendsObject3D>(
object:T,
options?:PlaceOptions
)=>T
Glues an object to the box so it follows layout and pose. Disposed with the instance.
place,
u: Uniforms<ColorsIn<{
readonly depth:0.04;
}>>
Input uniforms and one uniform per live param, for TSL graphs.
u})=>{
const
const shift:Node<"vec2">
shift=
u: Uniforms<ColorsIn<{
readonly depth:0.04;
}>>
Input uniforms and one uniform per live param, for TSL graphs.
u.
InputUniforms.pointer: UniformNode<"vec2">
Pointer in element UV, y up like uv(). 0..1 inside the box, not clamped outside.
Input uniforms and one uniform per live param, for TSL graphs.
u.
depth: UniformNode<"float">
depth)
const
const material:MeshBasicNodeMaterial
material=new
newMeshBasicNodeMaterial(
parameters?: MeshBasicNodeMaterialParameters
): MeshBasicNodeMaterial
Constructs a new mesh basic node material.
@param ― parameters - The configuration parameter.
MeshBasicNodeMaterial({
transparent?: boolean |undefined
Defines whether this material is transparent. This has an effect on
rendering as transparent objects need special treatment and are rendered
after non-transparent objects.
When set to true, the extent to which the material is transparent is
controlled by
Material#opacity
.
@default ― false
transparent:true})
const material:MeshBasicNodeMaterial
material.
NodeMaterialNodeProperties.colorNode:
| Node<"vec2">
| Node<"float">
| Node<"color">
| Node<"vec3">
| Node<"vec4">
|null
The diffuse color of node materials is by default inferred from the
color and map properties. This node property allows to overwrite the default
and define the diffuse color with a node instead.
material.colorNode=color(0xff0000);// define red color
If you don't want to overwrite the diffuse color but modify the existing
values instead, use
materialColor
.
material.colorNode= materialColor.mul(color(0xff0000));// give diffuse colors a red tint
@default ― null
colorNode=
functiontexture(
value?:Texture|TextureNode,
uvNode?:Node|null,
levelNode?:Node|number|null,
biasNode?:Node|null
):TextureNode(+1overload)
texture(
map: Texture<unknown, TextureEventMap>
The or as a texture, shared by all effects on the element. Needs media: true.
map,
coverUV:(uv?:Node<"vec2">)=> Node<"vec2">
Maps box UV to texture UV with the element's object-fit and object-position. Defaults to uv().
The opacity of node materials is by default inferred from the opacity
and alphaMap properties. This node property allows to overwrite the default
and define the opacity with a node instead.
If you don't want to overwrite the opacity but modify the existing
value instead, use
materialOpacity
.
@default ― null
opacityNode=
mask:(uv?:Node<"vec2">)=> Node<"float">
0..1 alpha mask at box UV for own materials: contain bars, radius, overflow clip, opacity.
Glues an object to the box so it follows layout and pose. Disposed with the instance.
place(
const plane:Mesh<
PlaneGeometry,
MeshBasicNodeMaterial,
Object3DEventMap
>
plane,{
PlaceOptions.replace?: boolean |undefined
Use this object as the element's GL copy instead of the surface mesh.
replace:true})
},
)
media: true limits the effect to <img> and <video>; on another element it is skipped with EFFECT_TARGET. Without it, map throws. Apart from the context the file is plain three.js, so it moves to another project with few changes.
Compose child elements
layers(selector) returns the layers of matching descendants in document order and keeps the array up to date. pose(layer, target, weight) blends one of them from its layout toward a target for the current frame. Call it in update; a layer you stop posing returns to its layout by itself.
src/effects/wheel.ts
import{
functioneffect(
setup:EffectSetup<Empty>
):Effect<Empty>(+2overloads)
Short form of defineEffect: defaults, optional options, setup. An unnamed effect takes its
registry key (the file name when a build plugin finds it).
Live resolved values. Read them in update, a read in setup is a snapshot.
params,
pose:(
layer: Layer,
target: PoseTarget,
weight: number
)=>void
Blends a layer from its layout towards target by weight for this frame. Call from update.
A taken copy wins: with a box only the pose's above applies, and the copy's own radius,
clip and non-zero above beat the pose's.
pose})=>{
const
const items:readonlyLayer[]
items=
layers:(selector:string)=> readonly Layer[]
Live layers of matching descendants in document order. The array updates in place.
Live resolved values. Read them in update, a read in setup is a snapshot.
params.
radius: number
radius
const items:readonlyLayer[]
items.
ReadonlyArray<Layer>.forEach(
callbackfn: (
value: Layer,
index: number,
array: readonly Layer[]
)=>void,
thisArg?: any
): void
Performs the specified action for each element in an array.
@param ― callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
@param ― thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
forEach((
item: Layer
item,
i: number
i)=>{
const
const angle:number
angle=(
i: number
i/
const items:readonlyLayer[]
items.
ReadonlyArray<Layer>.length: number
Gets the length of the array. This is a number one higher than the highest element defined in an array.
length)*
var Math:Math
An intrinsic object that provides basic mathematics functionality and constants.
Math.
Math.PI: number
Pi. This is the ratio of the circumference of a circle to its diameter.
PI*2+
pin: number
Pin progress, like u.pin.
pin*
var Math:Math
An intrinsic object that provides basic mathematics functionality and constants.
Math.
Math.PI: number
Pi. This is the ratio of the circumference of a circle to its diameter.
PI
const
const x:number
x=
var Math:Math
An intrinsic object that provides basic mathematics functionality and constants.
Math.
Math.sin(x: number): number
Returns the sine of a number.
@param ― x A numeric expression that contains an angle measured in radians.
sin(
const angle:number
angle)*
const r:number
r
const
const z:number
z=
var Math:Math
An intrinsic object that provides basic mathematics functionality and constants.
Math.
Math.cos(x: number): number
Returns the cosine of a number.
@param ― x A numeric expression that contains an angle measured in radians.
cos(
const angle:number
angle)*
const r:number
r-
const r:number
r
pose:(
layer: Layer,
target: PoseTarget,
weight: number
)=>void
Blends a layer from its layout towards target by weight for this frame. Call from update.
A taken copy wins: with a box only the pose's above applies, and the copy's own radius,
clip and non-zero above beat the pose's.
pose(
item: Layer
item,{
PoseTarget.x?: number |undefined
Centre x in world px.
x,
PoseTarget.z?: number |undefined
Depth in world px, towards the viewer.
z,
PoseTarget.rotateY?: number |undefined
Rotation around y in radians.
rotateY:
const angle:number
angle},
pin: number
Pin progress, like u.pin.
pin)
})
}
},
)
index.html
<section
class="sticky"
data-dio="wheel"
data-dio-radius="480"
>
<imgsrc="/work/aurora.jpg"/>
<imgsrc="/work/ridges.jpg"/>
<imgsrc="/work/lantern.jpg"/>
</section>
pin goes from 0 when the top of the section reaches the top of the viewport to 1 when its bottom reaches the bottom, so the images circle while the section is pinned. Targets are in world pixels with the viewport center at 0,0 and y up; angles are in radians. Every matching image gets a plain picture for the pose, even without effects of its own.
Rebuild on a change
Uniform params change live. A string or oneOf param has no uniform, so a change runs setup again: in wheel, a new items selector picks other children. Name other params in rebuild when setup uses their value to build something, such as the number of instances.
src/effects/sparks.ts
import{
functioneffect(
setup:EffectSetup<Empty>
):Effect<Empty>(+2overloads)
Short form of defineEffect: defaults, optional options, setup. An unnamed effect takes its
registry key (the file name when a build plugin finds it).
@remarks ― Use InstancedMesh if you have to render a large number of objects with the same geometry and material(s) but with different world transformations
The usage of InstancedMesh will help you to reduce the number of draw calls and thus improve the overall rendering performance in your application.
The most common use of a 4x4 matrix in 3D computer graphics is as a transformation matrix.
For an introduction to transformation matrices as used in WebGL, check out this tutorial
This allows a 3D vector representing a point in 3D space to undergo
transformations such as translation, rotation, shear, scale, reflection,
orthogonal or perspective projection and so on, by being multiplied by the
matrix. This is known as applying the matrix to the vector.
A Note on Row-Major and Column-Major Ordering:
The constructor and
Matrix3#set
method take arguments in
row-major
order, while internally they are stored in the
Matrix3#elements
array in column-major order.
This means that calling:
const m =new THREE.Matrix4();
m.set(11,12,13,14,
21,22,23,24,
31,32,33,34,
41,42,43,44);
will result in the elements array containing:
m.elements=[11,21,31,41,
12,22,32,42,
13,23,33,43,
14,24,34,44];
and internally all calculations are performed using column-major ordering.
However, as the actual ordering makes no difference mathematically and
most people are used to thinking about matrices in row-major order, the
three.js documentation shows matrices in row-major order. Just bear in
mind that if you are reading the source code, you'll have to take the
transpose of any matrices outlined here to make sense of the calculations.
Input uniforms and one uniform per live param, for TSL graphs.
u})=>{
const
const material:MeshBasicNodeMaterial
material=new
newMeshBasicNodeMaterial(
parameters?: MeshBasicNodeMaterialParameters
): MeshBasicNodeMaterial
Constructs a new mesh basic node material.
@param ― parameters - The configuration parameter.
MeshBasicNodeMaterial()
const material:MeshBasicNodeMaterial
material.
NodeMaterialNodeProperties.colorNode:
| Node<"float">
| Node<"vec2">
| Node<"vec3">
| Node<"vec4">
| Node<"color">
|null
The diffuse color of node materials is by default inferred from the
color and map properties. This node property allows to overwrite the default
and define the diffuse color with a node instead.
material.colorNode=color(0xff0000);// define red color
If you don't want to overwrite the diffuse color but modify the existing
values instead, use
materialColor
.
material.colorNode= materialColor.mul(color(0xff0000));// give diffuse colors a red tint
flag to true after updating all
the matrices.
Negatively scaled matrices are not supported.
@param ― index The index of an instance. Values have to be in the range [0, count]. Expects a Integer
@param ― matrix A 4x4 matrix representing the local transformation of a single instance.
setMatrixAt(
let i:number
i,
const matrix:Matrix4
matrix)
}
place:<
InstancedMesh<
PlaneGeometry,
MeshBasicNodeMaterial,
Object3DEventMap
>
>(
object: InstancedMesh<
PlaneGeometry,
MeshBasicNodeMaterial,
Object3DEventMap
>,
options?: PlaceOptions
)=> InstancedMesh<
PlaneGeometry,
MeshBasicNodeMaterial,
Object3DEventMap
>
Glues an object to the box so it follows layout and pose. Disposed with the instance.
place(
const sparks:InstancedMesh<
PlaneGeometry,
MeshBasicNodeMaterial,
Object3DEventMap
>
sparks,{
PlaceOptions.fit?:
|"none"
|"box"
|"contain"
|undefined
'box' (default) stretches a 1x1 object to the box, 'contain' scales it by min(width, height),
'none' keeps px units.
fit:'none'})
},
)
A rebuild runs in two phases: the old setup keeps drawing until the new one has compiled, so the element does not flash. It happens only while the element is visible, and changes in between merge into one. Rebuilds are not for tweens: a param that rebuilds more than 3 times a second gets a warning in development builds.
Know what happens on failure
A broken effect never breaks the page. Its element goes back to plain HTML, the other effects keep running, and the app reports an error with a code.
Plain HTML until the image loads a new source or crossorigin changes
A failed instance stays failed until it gets a new start: remove the name from data-dio and add it back, or save the file in development and the edit replaces it. To react in code, listen to status changes.
src/main.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'
exportconst
const app:App
app=
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.
The console.warn() static method outputs a warning message to the console at the "warning" log level. The message is only displayed to the user if the console is configured to display warning output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as yellow colors and a warning icon.