Skip to content

Media — Images, Audio, Video & Animation

import { Tabs, TabItem, Aside, Badge } from '@astrojs/starlight/components';


Set the background image.

AttributeTypeRequiredDescription
storage=stringYesPath to image file
time=msNoTransition duration
method=stringNoTransition method name
[bg storage=bg/forest.jpg time=1000 method=crossfade]

[bgm storage=… loop=… volume=… fadetime=…]

Section titled “[bgm storage=… loop=… volume=… fadetime=…]”

Start background music.

AttributeTypeRequiredDescription
storage=stringYesPath to audio file
loop=boolNoLoop playback (default: true)
volume=floatNoVolume 0.0–1.0
fadetime=msNoFade-in duration

Start BGM with a fade-in (alias for [bgm … fadetime=time]).

[stopbgm fadetime=…] / [fadeoutbgm time=…]

Section titled “[stopbgm fadetime=…] / [fadeoutbgm time=…]”

Stop BGM. [fadeoutbgm] is an alias for [stopbgm fadetime=time].

Smoothly change the BGM volume without stopping.

Pause and resume BGM at the current seek position.

Cross-fade: start new BGM while fading out the current one.

Change options on the currently-playing BGM without restarting.

TagDescription
[wb] / [wbgm]Wait for BGM fade to finish

Play a video as the background.

AttributeTypeRequiredDescription
storage=stringYesPath to video file
loop=boolNoLoop playback
volume=floatNoAudio volume

Stop the background video.

Wait until the background video has finished playing.


Apply a visual scene transition.

AttributeTypeDescription
method=stringTransition type (e.g. crossfade, wipe)
time=msDuration
rule=stringRule image for custom transitions

[fadein time=… color=…] / [fadeout time=… color=…]

Section titled “[fadein time=… color=…] / [fadeout time=… color=…]”

Fade in from or out to a solid colour.

[movetrans layer=… time=… x=… y=…]

Section titled “[movetrans layer=… time=… x=… y=…]”

Move a layer to (x, y) over time ms as a transition.


TagDescription
[quake time=… hmax=… vmax=…]Screen quake. hmax/vmax are maximum pixel displacement.
[shake time=… amount=… axis=…]Screen shake. axis= is "h", "v", or omitted for both.
[flash time=… color=…]Flash the screen with a colour.

[anim layer=… preset=… time=… loop=… delay=…]

Section titled “[anim layer=… preset=… time=… loop=… delay=…]”

Play a preset animation on a named layer.

AttributeTypeDescription
layer=stringTarget layer identifier
preset=stringAnimation preset name (see below)
time=msDuration
loop=boolLoop the animation
delay=msDelay before starting

Available presets: fadein, fadeout, slide_left, slide_right, slide_up, slide_down, zoom_in, zoom_out, bounce, rotate.

Cancel the ongoing animation on a layer.

Define a named keyframe sequence and apply it to a layer.

[keyframe name=myanim]
[frame time=0 opacity=0 x=0]
[frame time=500 opacity=1 x=200]
[frame time=1000 opacity=0 x=400]
[endkeyframe]
[kanim layer=bg name=myanim loop=false]
[wm]
[stop_kanim layer=bg]

[xanim] / [stop_xanim] apply the same keyframe mechanism to character layers.

TagDescription
[keyframe name=…]Begin a named keyframe definition
[frame time=… opacity=… x=… y=…]One keyframe inside a [keyframe] block
[endkeyframe]End the keyframe definition
[kanim layer=… name=… loop=…]Play a keyframe animation on a layer
[stop_kanim layer=…]Stop a keyframe animation
[xanim layer=… name=… loop=…]Play a keyframe animation on a character layer
[stop_xanim layer=…]Stop a character keyframe animation