Skip to content

Class: Storyboard ​

Defined in: src/beatmap/storyboard/storyboard.ts:20

A mutable osu! storyboard containing layers, drawable elements, and timing commands. Use getLayer to acquire layers, then add sprites, animations, or samples to them.

ts
import { Storyboard } from 'osu-files'

const storyboard = new Storyboard()
const layer = storyboard.getLayer('Foreground')

return { name: layer.name, depth: layer.depth }

Constructors ​

new Storyboard(): Storyboard

Returns ​

Storyboard

ts
import { Storyboard } from 'osu-files'

const storyboard = new Storyboard()
const layer = storyboard.getLayer('Foreground')

return { name: layer.name, depth: layer.depth }

Properties ​

backgroundOffset ​

backgroundOffset: object

Defined in: src/beatmap/storyboard/storyboard.ts:24

x ​

x: number = 0

y ​

y: number = 0


layers ​

layers: Map<string, StoryboardLayer>

Defined in: src/beatmap/storyboard/storyboard.ts:21


useSkinSprites ​

useSkinSprites: boolean = false

Defined in: src/beatmap/storyboard/storyboard.ts:23


variables ​

variables: Record<string, string> = {}

Defined in: src/beatmap/storyboard/storyboard.ts:22

Accessors ​

earliestEventTime ​

get earliestEventTime(): number | undefined

Defined in: src/beatmap/storyboard/storyboard.ts:83

The earliest command or element time, if the storyboard has events.

Returns ​

number | undefined

ts
import { Storyboard } from 'osu-files'

const storyboard = new Storyboard()

return storyboard.earliestEventTime

hasDrawable ​

get hasDrawable(): boolean

Defined in: src/beatmap/storyboard/storyboard.ts:75

Whether any layer contains a drawable storyboard element.

Returns ​

boolean

ts
import { Storyboard } from 'osu-files'

const storyboard = new Storyboard()

return storyboard.hasDrawable

latestEventTime ​

get latestEventTime(): number | undefined

Defined in: src/beatmap/storyboard/storyboard.ts:95

The latest command or element time, if the storyboard has events.

Returns ​

number | undefined

ts
import { Storyboard } from 'osu-files'

const storyboard = new Storyboard()

return storyboard.latestEventTime

Methods ​

clearLayers() ​

clearLayers(): void

Defined in: src/beatmap/storyboard/storyboard.ts:67

Removes every layer and its elements.

Returns ​

void

ts
import { Storyboard } from 'osu-files'

const storyboard = new Storyboard()

storyboard.getLayer('Foreground')
storyboard.clearLayers()
return storyboard.layers.size

getLayer() ​

getLayer(name): StoryboardLayer

Defined in: src/beatmap/storyboard/storyboard.ts:32

Returns an existing layer or creates it with the standard osu! depth.

Parameters ​

ParameterType
nameStoryboardLayerName

Returns ​

StoryboardLayer

ts
import { Storyboard } from 'osu-files'

const storyboard = new Storyboard()

const layer = storyboard.getLayer('Foreground')
return { name: layer.name, depth: layer.depth }

hasLayer() ​

hasLayer(name): boolean

Defined in: src/beatmap/storyboard/storyboard.ts:43

Checks whether a named layer exists.

Parameters ​

ParameterType
namestring

Returns ​

boolean

ts
import { Storyboard } from 'osu-files'

const storyboard = new Storyboard()

storyboard.getLayer('Foreground')
return storyboard.hasLayer('Foreground')

removeLayer() ​

removeLayer(nameOrLayer): void

Defined in: src/beatmap/storyboard/storyboard.ts:46

Removes a layer by name or by object reference.

Parameters ​

ParameterType
nameOrLayerstring | StoryboardLayer

Returns ​

void

ts
import { Storyboard } from 'osu-files'

const storyboard = new Storyboard()

storyboard.getLayer('Foreground')
storyboard.removeLayer('Foreground')
return storyboard.hasLayer('Foreground')

renameLayer() ​

renameLayer(oldName, newName): void

Defined in: src/beatmap/storyboard/storyboard.ts:57

Renames a layer while preserving its elements and depth.

Parameters ​

ParameterType
oldNamestring
newNameStoryboardLayerName

Returns ​

void

ts
import { Storyboard } from 'osu-files'

const storyboard = new Storyboard()

storyboard.getLayer('Foreground')
storyboard.renameLayer('Foreground', 'Overlay')
return storyboard.hasLayer('Overlay')

Released under the MIT License.