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 | |
|---|---|
pose | A pose of that character (typed) |
at | farleft, left, center, right, farright, or any name you add. Moving someone slides them there. |
distance | far, 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, y | Mirror, size (from the feet), offsets in stage pixels (see below). y: negative = up. |
parts | Layered portraits only; changing pose keeps these |
tint | A 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
- The two numbers are the share of the picture from its top edge:
0= the top,1= the bottom. The part between them fills the portrait height and its bottom sits on the screen's edge. - Nothing is ever cut in mid-air: only the screen's edges cut a picture. Below the second number the picture carries on past the bottom edge (raise the character with a distance or
yand the legs come into view, as in Ren'Py). Above the first number it sticks up above the shown part; to hide a head, make the shown part reach the top of the screen (scale= 100 /portraitHeight, about 1.3). portraitWidthstill limits how wide the whole picture gets; a picture that hits it shrinks, framing and all.- Distances,
show()andanimate()move and zoom from there (zoom grows from the screen's bottom edge). Theiryvalues were made for whole pictures: with cropped full-body art,closeandfacemay want lessy. - The side image and Settings → Voices are not affected (they use the face box). It works for plain, layered (Aseprite) and Spine portraits.
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
- The part named fills the normal portrait height, its bottom on the screen's bottom edge (behind the chat box, like the normal framing). To end on a face above the box, aim a little lower than the face: e.g.
[0.1, 0.45]. - Parts of the same size have the same zoom, so going from one to another is a pan; a smaller part zooms in.
framebecomes ascaleandy: ascale/ygiven in the same call wins, it wins overdistance, and it is part of saves and Back like any position.
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
- When it shows is a player setting (Settings → Text → Face next to the text):
offstage(only while the speaker is not on the stage: a voice on the phone, the player character),alwaysornever. - Size: the box is 300 px tall and
sizeis 0.8 → a 240 × 240 face. A 155 px box gives 150 (minSizewins over 124). A 140 px box gives 140: the face never sticks out of the box. The text moves aside to make room. - Place:
'inside'(default) sits in the box;'outside'sits next to the box onside(only with the layout'center'). Outside, the box always keeps the room free beside it, so it does not move when a line has no face. - Its frame is the look
sideImage(background, border). Take out itsbackgroundand border to show only the face, or give it a thicker border. Characters without a portrait show none.
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
},
- center: a box in the middle of the bottom. A side image inside it pushes the text over while it shows. With
sideImage.place: 'outside'the face sits next to the box instead. - full: the box spans the screen edge to edge. The text sits in the middle with
textSpacefree on both sides; the side image sits in its side's space (made smaller if the space is narrower), so the text never moves. The name tag starts where the text does. - TextDialog.tsx reads these: for anything else, edit it (below).
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' },
boxgoes over the normal chat box (dialoginlook/index.ts),nameover the name tag (it wins over the character'scolor),textover the text of their lines (a line's owncolorstill wins).- For another frame, give
boxa picture likelook/frames.tsdoes (image,slice,scale). Keep the border as wide as the normal box's: the text sits inside it. A frame picture covers abackgroundcolour. - Narration, speakers without a character file (
"Student A") and characters withoutchatBoxuse the normal box. Full-page text (nvl) always does. - The player's "Text box opacity" still fades only the box, so keep text colours solid.
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 | |
|---|---|
background | The box's look (dialog, a character's chatBox), faded by "Text box opacity" |
text | The typing text. Must stay, inside <DialogTextArea> (without it a line can't type; dev warns) |
continueMark | The ▼ once the line is done (null while typing), in the corner of the text area. Its look: src/content/ui/ContinueMark.tsx |
face | The side image, or null |
nameTag | The name on the top edge, or null (narration, full pages). Its look: src/content/ui/NameTag.tsx |
toolbar | Settings / Save / Load / … / Hide (its own file) |
voiceBar | How long the line's voice still plays (src/content/ui/VoiceBar.tsx), or null on a line without a voice. More |
- Each part goes in once. Also given:
speaker,name,nvl(full-page text),typed(the line has finished typing),read(read before, in any playthrough). Types:TextDialogSlotPropsin@/core/slots. - Three wrappers from
@/core/ui/ChatBox, each once, outside in. Theirsx(where, how wide, padding) is yours; they only add what the engine needs.<ChatBoxPlace>: where the box sits on the screen (hides on Hide).<ChatBoxFrame>: the box itself, measured for the side image's size (dev warns without it).<DialogTextArea>: keeps the text clear of the side image and scrolls full pages to the newest line. UseSHORT_SCREEN(@/core/layers/screen) for phones held sideways. <ChatBoxFrame>isposition: relative:position: 'absolute'inside it sits on the box. Give added picturespointerEvents: 'none'so a click still continues the text. They are not faded by "Text box opacity".- The frame has the CSS variable
--face-room: the width a side image inside the box takes (0pxwithout one). Something along the box's bottom keeps clear of the face withpl: 'var(--face-room, 0px)'(the toolbar row does).
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).
- It gets
durationMs(the whole voice) andelapsedMs(played so far). The bar is a CSS animationdurationMslong startedelapsedMsin (a negativeanimationDelay): it never redraws per frame. - It shows nothing while no clip plays (the clip ended, or a line without a voice).
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.
| id | Does |
|---|---|
settings | Opens Settings |
lock | Keeps an auto-hiding toolbar shown; its label is Lock / Unlock. Only with toolbar.autoHide |
save, load | The Saves window, to save / to load |
quickSave, quickLoad | The quick save slot |
skipBack | Back again and again (one line every toolbar.skipBackMs, 250) until pressed again, a click / confirm / answer, a window opening, or nothing is left |
lastChoice | Back to the last choice the player made: it is asked again (in a route also in earlier scenes, like Back) |
back | One line back |
auto | Auto-play on / off |
toChoice | Skip quickly to the next choice |
skip | Skip read lines on / off |
flowchart | The Flowchart. Only in visual novel mode |
replayVoice | Plays the line's voice again; disabled on lines without one |
favouriteVoices | Extras on its Voices tab. Only with voice.favourites.on |
hide | Hides 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
- It gets
buttons(each:id,labeltranslated,onwhile Auto / Skip / To choice / Skip back / Lock is on,disabledwhen it has nothing to do (draw it faded; presses are ignored),press()) andwhere('box'or'choices'). Types:SceneToolbarSlotPropsin@/core/slots. - Draw each with
<SceneToolbarButton button={b} sx={…}>(@/core/ui/SceneToolbarButton): it runs the action, keeps the click from also continuing the text, and keeps the label as the button's name for screen readers. Its children are what it shows. - Leave a button out of the list to hide it; sort the list to reorder.
Where the toolbar sits, and hiding it
// src/content/scenes.ts
toolbar: {
place: 'boxBottom', // 'boxTop' | 'boxBottom' | 'screen'
},
'boxBottom': a row inside the box along its bottom, at the right, clear of the side image (the ▼ and the voice bar sit above it).'boxTop'(the engine's default whenplaceis left out): on the box's top edge, at the right. Full-page text always uses this.'screen': the screen's bottom right corner, under the box (the box moves up to make room).
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 bar slides down
slidepx and fades out (ms) unless the mouse is withinzonepx of the game screen's bottom edge (across its whole width, however many buttons there are) or over the bar. It hidesdelayms after the mouse leaves. With "Reduce motion" it only fades. Both places follow it. - The player can keep it shown: a Lock button on the bar (id
lock) and "Keep the scene buttons shown" in Settings → Text (both only withautoHide). Remembered per device. - Keyboard focus inside the bar shows it. On touch screens (no mouse to hover with) it always shows.
- While hidden, clicks go through to the scene. Leave some room under the box so the bar doesn't cover it.
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>
- From
@/core/ui/Choice, theirsxis yours.<ChoiceList>holds the answers: arrows / d-pad move between them, nothing is focused at first (the first up / down focuses one, so hammering confirm through the dialogue never picks by accident), and a click on it doesn't reach the scene (dev warns without it).<ChoiceButton>is one answer: it picks it, and is disabled while its condition isn't met. Its children are what it shows. - Parts:
answers(eachindex,label,disabled= why it can't be picked ornull,chosen= picked before),timer(ornull),toolbar(ornullwhen a line shows),withLine. Types:ChoiceSlotPropsin@/core/slots. - Answer looks:
choiceandchoiceChoseninsrc/content/look.
Backgrounds and filters
The background library
A background in src/content/backgrounds/ is one of two things:
- One picture (or a video): drop the file in. Its id is its path without the extension. A language version sits next to it as
<name>.<language>.<ext>(Translations). - A picture with variants (time of day, lights on, rain): a folder with an
.asepritefile and anindex.ts, made exactly like a layered CG. Layers whose name starts with+are toggles;variantsnames sets of them. With variants a background has only those: addbase: {}(or any name) for the picture with no toggles on.
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()
- In a .vn file:
bg street,bg town/bus_stop evening(commands); the editor suggests ids and variants. - A file named
street.evening.pngis not a variant: the dev server warns and leaves it out. Variants always come from an .aseprite file. - Names: lowercase letters, digits and
_. Folders without anindex.tsgroup them. Files and folders starting with_are ignored. - New files are picked up while the dev server runs; nothing is downloaded until a background shows (plus the look-ahead). Saves remember a background by its id and variant, so they find it after an update.
- The lite build may shrink everything in a
backgroundsfolder (media settings).
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'
- Who wins on a character: their own tint (
show({ tint })or{ on: 'anna' }), else the characters' one, else the background variant's.filter(...)withoutonstill covers the whole stage on top of all of these. - A tint named like a preset replaces that preset. The map behind the scene gets only the tint's
csspart. - A tint changes at once (it does not fade); change it while the background crossfades or under a chapter card.
- Mask transitions stay full-screen only (backgrounds and CGs); characters fade and slide.
- All of it is part of saves, Back and the stage a route carries into its next scene.
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
},
rule: 0 (black) = shows first, 1 (white) = last.softness: width of the moving edge (0 hard, default 0.15).reverse: truestarts from white.duration: its default length.- Included:
wipeLeft / Right / Up / Down,irisOut,irisIn,clock,blinds,diagonal,pixels,swirl. - Works for pictures, layered CGs and plain colours. A video, a gradient, or going back to the map (
null) crossfades. - No mask while skipping or while a save catches up.
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 })
- The movie covers the scene. The game's music fades out for it and comes back (
keepMusic: trueleaves it playing). Its sound follows the master and Movies sliders (Settings → Audio; also for the movies in Extras), times its ownvolume. - Skipping: confirm, a click or a tap shows Skip; the same again skips.
skippable: falseturns that off. - The pause menu (or a hidden tab) pauses it.
- It is not shown again when a mid-scene save is loaded, when going Back, or while skipping.
- Per voice language: put the versions in language folders inside the movie's folder,
movies/opening/ja/opening.mp4andmovies/opening/en/opening.mp4(the languages ofvoice.languages), and import any one of them. It plays in the voice language the player picked, else the next language in the list that has it (soen/may be missing whileja/is there). Extras → Movies and a movie used as a background do the same. - Use H.264 mp4 or VP9 webm: both play in the desktop app, on Android and in browsers.
- A movie's own options (
fit,skippable, …) in its file are the defaults; options given tomovie()win. See Extras for the Movies tab.
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
},
- Characters are always behind it. Choices are always over it.
- Its frame (border, background, shadow) is the look part
insetinsrc/content/look/parts.ts. - It stays until
inset(null)or the end of the event; in a route it carries into the next scene with the rest of the stage. It is part of saves and Back, and of the look-ahead. - The .vn editor suggests the ids and variants.
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, y | Centre, in % of the screen. Default 50, 50. |
width or height | In % of the screen; the other side follows the picture. Default width 40. |
opacity, scale, rotate | 0..1, a factor, degrees. |
layer | 'back' behind the characters, 'front' in front of them (default), 'top' over the text box too. |
pixelated, duration | Hard 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
shakewithdurationstops by itself.startShake(strength)andstopShake(duration)start and end a shake yourself, so you can talk over it; several shakes add up, andstartShakeagain changes the strength.fadekeeps its colour until you change it: a secondfadewith another colour crossfades into it. Colours can be any CSS colour, including transparent ones ('rgba(0,0,0,0.5)').flashreturns to the colour a fade had.animatevalues:x(a stage position or % of the width),y(stage pixels, positive = down),offsetX(stage pixels),scale,rotate(degrees),opacity.- Tween options:
duration(ms, default 400),ease,delay,repeat,yoyo. - Eases:
linear, andsine/quad/cubic/quart/quint/expo/circ/back/elastic/bounceeach withIn,Out,InOut('quadInOut', the default). AlsocubicBezier(x1, y1, x2, y2)or your own(t) => number. - Stage pixels (
y,offsetX, shake strength): pixels on a screen 720 tall. They grow and shrink with the real game screen, soy: -140is the same share of the screen on a phone and a 4K monitor. Change the 720 (and the largest portrait size) understageinsrc/content/config/screen.ts. - The camera zooms the map behind the scene as well. Everything resets when the event ends.
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.