Skip to content

Getting started

Stéphane Traut edited this page Jan 11, 2022 · 5 revisions

dotosb is a library that is coming from NPM (node package manager). To initialize a project, you can create a folder in your computer and run npm install dotosb. This will create you a node_modules folder and a package.json file.

You can now create a simple JS file (for example storyboard.js) and run node storyboard.js to execute it.


Creating a very simple storyboard

In dotosb, there is some basic functions that can be used to achieve some simple tasks (creating a sprite, giving it parameters). The main workflow is to Create your storyboard, modify its content, and at the end, render it in an osb file that your beatmap gonna read.

Here's a very basic example of a storyboard:

// Import the npm library
import { Storyboard } from "dotosb";

// Create a new storyboard
const storyboard = new Storyboard();

// Create a new sprite
const sprite = storyboard.createSprite('bg.jpg');

// Give a Fade parameter to the sprite
sprite.add('F', [0, 1000], [1, 0]);

// Render the storyboard
storyboard.write('storyboard.osb');

If you run the file, you'll see a new storyboard.osb file which contains the following data:

[Events]
//Background and Video events
//Storyboard Layer 0 (Background)
Sprite,Background,Centre,"bg.jpg",320,240
 F,0,0,1000,1,0
//Storyboard Layer 1 (Fail)
//Storyboard Layer 2 (Pass)
//Storyboard Layer 3 (Foreground)
//Storyboard Layer 4 (Overlay)

It's also possible to customize the customSprite options using the following code:

createSprite('bg.jpg', {
  layer: 'Foreground',
  origin: 'CentreLeft',
  x: 0,
  y: 240
});

// > Sprite,Foreground,CentreLeft,"bg.jpg",0,240

For more informations about the functions, check the API Reference

Clone this wiki locally