Sonolus Wiki

10. Time Scale

In this chapter, we will setup and implement Time Scale Change.

Time Scale Change

Implementation of Time Scale Change is very similar to BPM Change as seen in the previous chapter.

export const skin = defineSkin({
    sprites: {
        // ...
        timeScaleChangeLine: SkinSpriteName.GridYellow,
    },
})
export const skin = defineSkin({
    sprites: {
        // ...
        timeScaleChangeLine: SkinSpriteName.GridYellow,
    },
})
export const archetypes = defineArchetypes({
    // ...
    [EngineArchetypeName.TimeScaleChange]: TimeScaleChange,
})
export const archetypes = defineArchetypes({
    // ...
    [EngineArchetypeName.TimeScaleChange]: TimeScaleChange,
})
export class TimeScaleChange extends Archetype {
    import = this.defineImport({
        beat: { name: EngineArchetypeDataName.Beat, type: Number },
        timeScale: { name: EngineArchetypeDataName.TimeScale, type: Number },
    })

    render() {
        line(skin.sprites.timeScaleChangeLine, this.import.beat, 0.5)

        print(
            this.import.timeScale,
            bpmChanges.at(this.import.beat).time,
            PrintFormat.TimeScale,
            'auto',
            PrintColor.Yellow,
            'left',
        )
    }
}
export class TimeScaleChange extends Archetype {
    import = this.defineImport({
        beat: { name: EngineArchetypeDataName.Beat, type: Number },
        timeScale: { name: EngineArchetypeDataName.TimeScale, type: Number },
    })

    render() {
        line(skin.sprites.timeScaleChangeLine, this.import.beat, 0.5)

        print(
            this.import.timeScale,
            bpmChanges.at(this.import.beat).time,
            PrintFormat.TimeScale,
            'auto',
            PrintColor.Yellow,
            'left',
        )
    }
}