@osbjs/osbjs
Version:
a minimalist osu! storyboarding framework
72 lines (71 loc) • 3.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandGroup = void 0;
const Enums_1 = require("../Enums");
const Command_1 = require("./Command");
class CommandGroup {
constructor(header) {
this.header = header;
this.commands = [];
}
Fade(startTime, endTime, startOpacity, endOpacity, easing = Enums_1.Easing.Linear) {
this.commands.push(new Command_1.Command('F', easing, startTime, endTime, startOpacity, endOpacity));
}
FadeAtTime(time, opacity) {
this.commands.push(new Command_1.Command('F', Enums_1.Easing.Linear, time, time, opacity, opacity));
}
Move(startTime, endTime, startPosition, endPosition, easing = Enums_1.Easing.Linear) {
this.commands.push(new Command_1.Command('M', easing, startTime, endTime, startPosition, endPosition));
}
MoveAtTime(time, position) {
this.commands.push(new Command_1.Command('M', Enums_1.Easing.Linear, time, time, position, position));
}
MoveX(startTime, endTime, startX, endX, easing = Enums_1.Easing.Linear) {
this.commands.push(new Command_1.Command('MX', easing, startTime, endTime, startX, endX));
}
MoveXAtTime(time, x) {
this.commands.push(new Command_1.Command('MX', Enums_1.Easing.Linear, time, time, x, x));
}
MoveY(startTime, endTime, startY, endY, easing = Enums_1.Easing.Linear) {
this.commands.push(new Command_1.Command('MY', easing, startTime, endTime, startY, endY));
}
MoveYAtTime(time, y) {
this.commands.push(new Command_1.Command('MY', Enums_1.Easing.Linear, time, time, y, y));
}
Scale(startTime, endTime, startScale, endScale, easing = Enums_1.Easing.Linear) {
this.commands.push(new Command_1.Command('S', easing, startTime, endTime, startScale, endScale));
return this;
}
ScaleAtTime(time, scale) {
this.commands.push(new Command_1.Command('S', Enums_1.Easing.Linear, time, time, scale, scale));
}
ScaleVec(startTime, endTime, startScale, endScale, easing = Enums_1.Easing.Linear) {
this.commands.push(new Command_1.Command('V', easing, startTime, endTime, startScale, endScale));
}
ScaleVecAtTime(time, scale) {
this.commands.push(new Command_1.Command('V', Enums_1.Easing.Linear, time, time, scale, scale));
}
Rotate(startTime, endTime, startAngle, endAngle, easing = Enums_1.Easing.Linear) {
this.commands.push(new Command_1.Command('R', easing, startTime, endTime, startAngle, endAngle));
}
RotateAtTime(time, angle) {
this.commands.push(new Command_1.Command('R', Enums_1.Easing.Linear, time, time, angle, angle));
}
Color(startTime, endTime, startColor, endColor, easing = Enums_1.Easing.Linear) {
this.commands.push(new Command_1.Command('C', easing, startTime, endTime, startColor, endColor));
}
ColorAtTime(time, color) {
this.commands.push(new Command_1.Command('C', Enums_1.Easing.Linear, time, time, color, color));
}
Parameter(startTime, endTime, parameter) {
this.commands.push(new Command_1.Command('P', Enums_1.Easing.Linear, startTime, endTime, parameter, parameter));
}
getOsbString() {
let str = this.header;
this.commands.forEach((command) => {
str += ` ${command.getOsbString()}\n`;
});
return str;
}
}
exports.CommandGroup = CommandGroup;