Events: the stage

What the player sees during a scene: portraits, backgrounds and filters, pictures, effects and full-page text.

Portraits on stage

show('anna')                                         // default pose, centre
show('anna', { at: 'left', pose: 'happy', flip: true })
show('jack', { parts: { outfit: 'hoodie' } })        // layered portraits: swap one part
show('anna', { distance: 'close' })                  // steps nearer (a name from scenes.ts)
show('jack', { at: 'center', scale: 0.35, y: -140 }) // small and high = far away …
await animate('jack', { scale: 1, y: 0 }, { duration: 1500 })   // … then walk closer
hide('anna'); hide()
Option
poseA pose of that character (typed)
atfarleft, left, center, right, farright, or any name you add. Moving someone slides them there.
distancefar, normal, close, face, or any name you add: a size and a height together. Someone already on stage steps there; scale / y given in the same call win.
flip, scale, offsetX, yMirror, size (from the feet), offsets in stage pixels (see below). y: negative = up.
partsLayered portraits only; changing pose keeps these
tintA filter or tint on this character only (tints); null = none, even when everyone else has one

The speaker is highlighted and others dimmed. New portraits fade in. Characters without portraits get a coloured placeholder.

Positions, distances, their timings and the dimming live in src/content/scenes.ts under stage:

stage: {
  positions: { farleft: 10, left: 25, center: 50, right: 75, farright: 90 }, // % of the screen width
  distances: {
    far: { scale: 0.75, y: -40 },   // y: stage pixels down (negative = up)
    normal: { scale: 1, y: 0 },
    close: { scale: 1.3, y: 110 },
    face: { scale: 1.9, y: 420 },
  },
  distanceMs: 300, slideMs: 350, fadeInMs: 300,
  dim: { on: true, brightness: 0.55, fadeMs: 200 }, // on: false = nobody goes darker
}

How much of a portrait shows (full-body art)

By default the whole picture fits portraitHeight (78% of the screen height, src/content/config/screen.ts) and its bottom stands on the screen's bottom edge. For full-body art, name the part of the picture that should fill that height instead; the rest carries on past it (below the screen, or above the shown part), like Ren'Py's anchor, position and zoom but in parts of the picture instead of pixels:

// src/content/config/screen.ts: every character
stage: { …, show: [0, 0.6] },   // top of the picture (0) to 60% down: head to waist

// src/content/characters/anna/index.ts: only her
stage: {
  show: [0, 0.55],   // head to waist; her legs are below the screen
  scale: 0.95,       // a little smaller than the others
  x: 0, y: 10,       // a nudge in stage pixels (y > 0 = down)
},

// other framings
show: [0, 1]       // the whole picture (the default)
show: [0, 0.8]     // head to the knees
show: [0.25, 1], scale: 1.3   // neck to feet fills the screen's height: the head is above the top edge

Framing for one moment, and animating it

The same numbers work in show() and animate() as frame, for one moment of a scene. They are measured against the character's own framing above, so [0, 1] is always their normal look.

show('anna', { frame: [0.65, 1] })                          // only her legs (the bottom 35%)
await animate('anna', { frame: [0, 0.35] }, { duration: 2500, ease: 'quadInOut' })   // pan up to her face
await animate('anna', { frame: [0, 1] }, { duration: 600 }) // back to normal

// .vn
show anna frame 0.65 1
frame anna 0 0.35 ms 2500
frame anna 0 1 ms 600

New names are typed at once (at: 'midleft') and the .vn editor suggests them. Without at a new character stands at center (or the first position if you removed it).

Side image

The speaker's face next to the text, cut from their portrait with their face box (the one Settings → Voices uses too).

// src/content/scenes.ts
sideImage: {
  showByDefault: 'offstage',  // new players; the player picks in Settings → Text
  size: 0.8,                  // a square, 80% of the text box's height…
  minSize: 150,               // …but at least 150 px on a 720-tall screen…
  side: 'left',               // …and never taller than the box
  inset: [12, 6],             // space to the box's edge, px: normal, short screens
  place: 'inside',            // 'inside' the box, or 'outside' next to it
},

say('anna', 'Are you there?', { face: 'worried' })           // the pose shown in the side image for this line

The chat box's layout: center or full

// src/content/scenes.ts
textBox: {
  layout: 'center',         // or 'full'
  maxWidth: 960,            // center: the widest the box gets, px
  margin: [16, 4],          // center: screen left free on each side, px: normal, short screens
  textSpace: [200, 110],    // full: room on each side of the text, px
},

A chat box per character

A character can have their own chat box while they speak. In their file (src/content/characters/anna/index.ts) name looks from src/content/look/parts.ts:

// characters/anna/index.ts
chatBox: { box: 'annaBox', name: 'annaName', text: 'annaText' },   // each one is optional

// look/parts.ts
annaBox: { css: { boxShadow: '0 0 22px rgba(244, 143, 177, 0.55)' } },
annaName: { background: '#f48fb1', color: '#3a0d1f' },
annaText: { color: '#ffe9f1' },

The chat box's layout: TextDialog.tsx

src/content/ui/TextDialog.tsx lays out the chat box from parts the engine makes. Move them, leave some out, or add your own (a logo, a page number):

// src/content/ui/TextDialog.tsx
import { ChatBoxFrame, ChatBoxPlace, DialogTextArea } from '@/core/ui/ChatBox'

export function TextDialog({ background, text, continueMark, face, nameTag, toolbar, nvl }: TextDialogSlotProps) {
  return (
    <ChatBoxPlace sx={{ position: 'absolute', left: 0, right: 0, bottom: 0, p: 2, display: 'flex', justifyContent: 'center' }}>
      <ChatBoxFrame sx={{ width: 'min(960px, 100%)' }}>
        {background}
        <DialogTextArea sx={{ minHeight: 150, px: 3, pt: 2.5, pb: 2 }}>
          {text}
          {continueMark}
        </DialogTextArea>
        {face}{nameTag}{toolbar}
        <Box component="img" src={logo} alt="" sx={{ position: 'absolute', right: 12, bottom: 12, width: 40, pointerEvents: 'none' }} />
      </ChatBoxFrame>
    </ChatBoxPlace>
  )
}
Part
backgroundThe box's look (dialog, a character's chatBox), faded by "Text box opacity"
textThe typing text. Must stay, inside <DialogTextArea> (without it a line can't type; dev warns)
continueMarkThe ▼ once the line is done (null while typing), in the corner of the text area. Its look: src/content/ui/ContinueMark.tsx
faceThe side image, or null
nameTagThe name on the top edge, or null (narration, full pages). Its look: src/content/ui/NameTag.tsx
toolbarSettings / Save / Load / … / Hide (its own file)
voiceBarHow long the line's voice still plays (src/content/ui/VoiceBar.tsx), or null on a line without a voice. More

The voice bar: VoiceBar.tsx

While a line's voice plays, the word Voice with a bar that empties until the longest clip of the line ends (a line said together has several). Default place: the right of the box, just above the ▼. Its look is src/content/ui/VoiceBar.tsx; where it sits is TextDialog.tsx (the voiceBar part).

The toolbar's buttons: SceneToolbar.tsx

src/content/ui/SceneToolbar.tsx draws the toolbar's buttons: words or icons, gaps, sizes, order, which ones show. What each button does and its on / off state are the engine's; where the toolbar sits is toolbar.place (below). The strip's frame is sceneToolbar in src/content/look/parts.ts.

idDoes
settingsOpens Settings
lockKeeps an auto-hiding toolbar shown; its label is Lock / Unlock. Only with toolbar.autoHide
save, loadThe Saves window, to save / to load
quickSave, quickLoadThe quick save slot
skipBackBack again and again (one line every toolbar.skipBackMs, 250) until pressed again, a click / confirm / answer, a window opening, or nothing is left
lastChoiceBack to the last choice the player made: it is asked again (in a route also in earlier scenes, like Back)
backOne line back
autoAuto-play on / off
toChoiceSkip quickly to the next choice
skipSkip read lines on / off
flowchartThe Flowchart. Only in visual novel mode
replayVoicePlays the line's voice again; disabled on lines without one
favouriteVoicesExtras on its Voices tab. Only with voice.favourites.on
hideHides the box and choices

That is also the default order. The default file shows icons for most of them and the words Save / Load / Q.Save / Q.Load (icons on phones held sideways, where the words don't fit); each button's name shows as a tooltip.

// src/content/ui/SceneToolbar.tsx: a picture instead of the word
import autoIcon from './assets/ui/auto.svg'
const ICONS = {
  auto: autoIcon,                                     // an image file (.svg, .png…)
  hide: <svg viewBox="0 0 16 16" width="16" height="16">
          <path d="M2 8h12" stroke="currentColor" />   // your own SVG: currentColor = the button's colour
        </svg>,
}
const LABEL_WITH_ICON = false   // true = the word next to the icon

Where the toolbar sits, and hiding it

// src/content/scenes.ts
toolbar: {
  place: 'boxBottom',   // 'boxTop' | 'boxBottom' | 'screen'
},

TextDialog.tsx reads it and wraps the toolbar part in <SceneToolbarPlace> (@/core/ui/SceneToolbarPlace), whose sx places it; edit that for any other spot. While choices show without a line, src/content/ui/Choice.tsx places it (default: the bottom right corner).

To hide it until the mouse comes near, in src/content/scenes.ts:

toolbar: {
  autoHide: { zone: 50, delay: 400, slide: 24, ms: 200 },   // null = always shown
},

The choices' layout: Choice.tsx

src/content/ui/Choice.tsx lays out a choice: where the answers sit, their look and spacing, the ✓ mark, the time-left bar, and the toolbar while no line shows.

<ChoiceList sx={{ display: 'flex', flexDirection: 'column', gap: 1.5, width: 'min(520px, 90cqw)' }}>
  {timer}
  {answers.map((answer) => (
    <ChoiceButton key={answer.label} answer={answer} sx={…}>
      {answer.chosen && scenes.choices.chosenMark}{answer.label}
    </ChoiceButton>
  ))}
</ChoiceList>

Backgrounds and filters

The background library

A background in src/content/backgrounds/ is one of two things:

src/content/backgrounds/
  street.png                       # 'street'
  street.ja.png                    # the Japanese version of street.png
  school/classroom.webp            # 'school/classroom'
  town/bus_stop/index.ts           # 'town/bus_stop', with variants
  town/bus_stop/bus_stop.aseprite  # layers "Day" and "+evening"
// src/content/backgrounds/town/bus_stop/index.ts
import { defineBackground } from '@/core/define'
import picture from './bus_stop.gen'   // made from bus_stop.aseprite

export default defineBackground({
  image: picture,
  variants: {
    day: {},                     // no toggles on
    evening: { evening: true },  // the "+evening" layer on
  },
})
bg('street')                                       // ids and variants are typed: a typo is an error
bg('town/bus_stop', 'evening')                     // a background with variants must name one
bg('street', null, { transition: 'wipeLeft', duration: 800 })   // the options of background()

Colours, gradients and other files

background('#203040')                            // a colour (also 'rgba(…)', '#rrggbbaa', 'transparent')
background('linear-gradient(#123, #456)')         // any CSS gradient
background(forestUrl)                             // an image (import it)
background(null)                                  // the map again
cg('pond_memory', 'base')                         // a gallery picture; also unlocks it in Extras
cg('pond_memory', 'crying.full_moon')             // a variant of a layered CG (art → layered CGs)
filter('flashback')                               // presets: flashback, night, dream, blur
filter({ css: 'grayscale(1)' })                   // any CSS filter
filter(null)

Tints, and filters on one part

filter('evening', { on: 'characters' })           // every portrait (a tint from scenes.ts)
filter('blur', { on: 'background' })               // the background / CG only
filter('night', { on: 'anna' })                    // one character
show('anna', { tint: 'night' })                     // the same while showing her
filter({ color: '#ff9f80', strength: 0.4 }, { on: 'characters' })   // your own tint
filter(null, { on: 'characters' })                // remove it again

A tint multiplies a colour over the picture (white = no change, transparent edges stay transparent), then runs an optional CSS filter: the evening and night look of character art. Presets, tints and { css } work on every part. Name them in src/content/scenes.ts:

tints: {
  evening: { color: '#ffc49a', strength: 0.5 },
  night: { color: '#7d8cd0', strength: 0.6, css: 'saturate(0.8)' },
},
// A background variant that tints the characters by itself:
tintByBackground: { evening: 'evening', night: 'night' },   // bg('classroom', 'evening') -> 'evening'

In .vn: filter evening on characters, filter none on anna, show anna tint night.

A background can be a colour, a CSS gradient, a picture or a video (import rain from './rain.webm', background(rain): it loops without sound).

Backgrounds crossfade (400 ms): the new picture fades in on top while the old one stays fully shown under it, so nothing dark shows through halfway (also between two variants of one layered background or CG). Going back to the map (null) fades the picture out. A see-through picture (a PNG with transparent parts) shows the old one through those parts until the fade ends. background('#000', { duration: 0 }) changes at once. Filters apply to the map behind the scene too.

Mask transitions

background(room, { transition: 'wipeLeft', duration: 800 })
cg('pond_memory', 'base', { transition: 'swirl' })

The new picture comes in through a mask instead of a crossfade (Ren'Py's ImageDissolve, KiriKiri's universal transition). The names are in src/content/scenes.ts:

transitions: {
  wipeLeft: { rule: (x) => 1 - x },                 // a function of the place: x, y from 0 to 1
  irisOut: { rule: (x, y) => Math.hypot(x - 0.5, y - 0.5) / 0.71 },
  swirl: { rule: swirl, softness: 0.2 },             // a greyscale picture you import
},

Video

// src/content/movies/opening/index.ts: a movie that unlocks in Extras → Movies
import video from './opening.mp4'                  // mp4 or webm
export default defineMovie({ title: 'Opening', video /*, poster, fit, skippable, volume, keepMusic */ })

await movie('opening')                             // plays it, unlocks it, then the script goes on
await movie('opening', { unlock: false })          // plays it without unlocking

import opening from './opening.mp4'              // or a plain file (never in Extras)
await movie(opening)
await movie(opening, { skippable: false, fit: 'cover', volume: 0.8, keepMusic: true })

Look-ahead

Like Ren'Py, an event loads its pictures before it needs them. The build lists the pictures each event uses, in script order: imported images, bg(…), background('…png'), cg(…), inset(…) and show(…) (all portraits of that character). While the event runs, the next events.preloadAhead of them (src/content/config/media.ts, default 3) are downloaded and decoded. Pictures picked at runtime (a variable, a computed id) are missed and load when shown, as before.

A framed picture in the middle: inset()

A smaller picture in a frame, in the middle of the screen over the background (a close-up, a chibi scene). The pictures live in src/content/insets/ and work like the background library: a plain file, or a folder with an .aseprite file and an index.ts with variants (defineBackground).

bg('shrine', 'night')              // the night shrine behind
inset('sneaking', 'red_girl')      // src/content/insets/sneaking, its variant red_girl
inset('sneaking', 'blue_girl')     // another one: crossfades inside the frame
inset('closeup', null, { duration: 800 })   // a plain picture, a slower fade
inset(null)                       // fades away

// .vn
inset sneaking red_girl
inset closeup ms 800
inset none
// src/content/scenes.ts
inset: {
  width: 62,              // % of the screen
  aspectRatio: '16 / 9',
  y: 43,                  // where its middle is, % from the top
  fadeMs: 300,
  layer: 'underBox',      // 'underBox': the chat box covers it; 'overBox': it covers the chat box
},

Pictures on stage

import letter from './letter.png'

await image('letter', letter, { y: 40, width: 30, layer: 'top' })   // appears (300 ms)
await image('letter', letter, { x: 70, rotate: 8, duration: 600 })  // the same name again = it moves / changes
await image('letter', null)                                        // goes away
await clearImages()                                                // all of them
Option
x, yCentre, in % of the screen. Default 50, 50.
width or heightIn % of the screen; the other side follows the picture. Default width 40.
opacity, scale, rotate0..1, a factor, degrees.
layer'back' behind the characters, 'front' in front of them (default), 'top' over the text box too.
pixelated, durationHard pixel edges; ms to appear, move or go (default 300).

For item close-ups, letters, maps, overlays. Pictures are part of mid-scene saves and Back.

Effects

Every effect returns a promise. await it to wait until it ends; leave out await to let it run while the script goes on. To start several things together and wait for all of them, use Promise.all:

fade('#ffffff51', 2000)                       // starts, doesn't wait
await say('hero', 'Ehh... What?')            // typed while the fade runs

await Promise.all([say('hero', 'Ehh... What?'), fade('#ffffff51', 2000)])  // waits for both

In .vn scripts the same is meanwhile and together:.

await animate('anna', { x: 'left', rotate: -10, scale: 1.2, opacity: 0.5 }, { duration: 600, ease: 'backOut' })
void animate('anna', { y: -40 }, { duration: 140, yoyo: true, repeat: 1 })    // a hop, not awaited
await camera({ zoom: 1.6, focus: 'anna' })       // zoom on a character (or { x: %, y: % })
await camera({ zoom: 1, focus: { x: 50, y: 50 } })
await shake({ strength: 6, duration: 250 })
startShake(6)                                    // an earthquake that goes on…
await say('anna', 'The ground is moving!')      // …while lines are spoken
await stopShake(400)                             // …until you stop it (eases out over 400 ms)
await flash('#ffffff', 250)
await fade('#000000', 400)  …  await fade(null, 400)
await fade('#3f3f3f', 2000)  await fade('#ffffff', 2000)   // crossfades colour and opacity

Named moves

// src/content/scenes.ts — each step is relative to where the character stood
moves: {
  hop: [{ y: -28, duration: 110, ease: 'quadOut' }, { duration: 140, ease: 'quadIn' }],   // a step with only a duration = back to the start
  nod: [{ y: 12, duration: 120 }, { duration: 140 }],
},

await move('anna', 'hop')

Steps take offsetX, y (stage pixels; negative y = up), scale, rotate, opacity, duration (ms, default 150) and ease. Included: hop, nod, shakeHead, startle, lean, leanBack, tremble, sink. Names are checked and autocompleted.

Weather in a scene

weather('snow')                       // rain, snow, petals, embers: src/content/weather.ts
weather('petals', { intensity: 0.3 })
weather(null)                         // stops; it also ends with the event

The same kinds as on maps. Add your own in content/weather.ts (shape, how many, speed, drift, size, colour): the name works everywhere at once.

Full-page text

nvl()                               // lines now pile up on a page over the scene
narrate('The rain had not stopped for three days.')
say('anna', 'And it will not stop today.')
clearPage()                         // a new, empty page
nvl(false)                          // back to the box at the bottom

nvl: { width: 76, maxLines: 0 } in content/scenes.ts: page width in % of the screen, and after how many lines a new page starts by itself (0 = only on clearPage()). The page's look is nvlPage. Skip, Auto, Back, the log and saving work as in the box.