@osbjs/osbjs
Version:
a minimalist osu! storyboarding framework
29 lines (28 loc) • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Command = void 0;
const Utils_1 = require("../Utils");
class Command {
constructor(identifier, easing, startTime, endTime, startValue, endValue) {
this.identifier = identifier;
this.easing = easing;
this.startTime = typeof startTime == 'string' ? (0, Utils_1.parseOsuTimestamp)(startTime) : Math.round(startTime);
this.endTime = typeof endTime == 'string' ? (0, Utils_1.parseOsuTimestamp)(endTime) : Math.round(endTime);
this.startValue = startValue;
this.endValue = endValue;
this.duration = this.startTime - this.endTime;
}
getOsbString() {
let easingStr = this.easing.toString();
let startTimeStr = this.startTime.toString();
let endTimeStr = this.startTime != this.endTime ? this.endTime.toString() : '';
let startValueStr = this.startValue.toString();
let endValueStr = this.endValue.toString();
let parameters = [this.identifier, easingStr, startTimeStr, endTimeStr, startValueStr];
let result = parameters.join(',');
if (startValueStr != endValueStr)
result += ',' + endValueStr;
return result;
}
}
exports.Command = Command;