clumsy-graphics
Version:
a tool for rapidly developing animations where frames are described using svg elements à la react 🙃
47 lines (46 loc) • 2.33 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const os_1 = __importDefault(require("os"));
const path_1 = __importDefault(require("path"));
const convertAnimationMp4ToGif_1 = require("./convertAnimationMp4ToGif/convertAnimationMp4ToGif");
const decodeData_1 = require("./helpers/decodeData");
const ClumsyGraphicsCommand_1 = require("./models/ClumsyGraphicsCommand");
const renderAnimationModule_1 = require("./renderAnimationModule/renderAnimationModule");
const renderAnimationModuleFrame_1 = require("./renderAnimationModuleFrame/renderAnimationModuleFrame");
const startAnimationDevelopment_1 = require("./startAnimationDevelopment/startAnimationDevelopment");
runClumsyGraphicsCommand();
async function runClumsyGraphicsCommand() {
const graphicsRendererCommand = await (0, decodeData_1.decodeData)({
targetCodec: ClumsyGraphicsCommand_1.ClumsyGraphicsCommandCodec,
inputData: (0, ClumsyGraphicsCommand_1.parseCommandLineArgs)({
processArgv: process.argv,
}),
});
switch (graphicsRendererCommand.commandName) {
case 'startDevelopment':
(0, startAnimationDevelopment_1.startAnimationDevelopment)({
clientServerPort: 3000,
generatedAssetsDirectoryPath: path_1.default.resolve(__dirname, './developmentAssets'),
numberOfFrameRendererWorkers: os_1.default.cpus().length - 1,
...graphicsRendererCommand.commandApi,
});
break;
case 'renderAnimation':
await (0, renderAnimationModule_1.renderAnimationModule)({
numberOfFrameRendererWorkers: os_1.default.cpus().length - 1,
suppressWorkerStdout: false,
...graphicsRendererCommand.commandApi,
});
break;
case 'renderAnimationFrame':
await (0, renderAnimationModuleFrame_1.renderAnimationModuleFrame)(graphicsRendererCommand.commandApi);
break;
case 'convertAnimationToGif':
(0, convertAnimationMp4ToGif_1.convertAnimationMp4ToGif)(graphicsRendererCommand.commandApi);
break;
}
}