mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-14 08:18:44 +00:00
feat(gacha): render the beta wish as a pack-cards pack opening
/api/gachabeta now tears open a pack-cards collectible pack whose card shows the request's label, the same B/A/S rank as /api/gacha, and one star per rarity level; rarity also picks the card material and the pack colour. pack-cards animates on the browser clock, so the route drives a shared headless Chrome in deterministic mode over a debugging pipe, steps virtual time frame by frame, tears the pack with a scripted drag, and encodes the captured frames with Remotion's bundled ffmpeg. The page and package are served from disk with all other requests blocked. The browser stays alive per process and is warmed at start-up, because the first render compiles the pack's WebGL shaders in software. The Remotion beta composition and its scene code are removed. pack-cards is installed from a GitHub tarball pinned to a commit, since it has no npm release and a moving URL would break npm ci.
This commit is contained in:
1 parent
25eb1414d4
commit
8c06fdf498
19 files changed
+857
-1550
No files matched your search
@@ -11,7 +11,7 @@ const config = {
|
||||
renderTimeoutMs: 30000,
|
||||
};
|
||||
|
||||
const app = await buildServer({config, warmRemotionBundle: true});
|
||||
const app = await buildServer({config, warmRenderers: true});
|
||||
|
||||
try {
|
||||
const response = await app.inject({
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {mkdir, writeFile} from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import {renderGachaBetaVideo, renderGachaVideo} from '../src/render/render-gacha.js';
|
||||
import {closeGachaBetaBrowser, renderGachaBetaVideo} from '../src/render/render-gacha-beta.js';
|
||||
import {renderGachaVideo} from '../src/render/render-gacha.js';
|
||||
import {renderWheelGif} from '../src/render/render-gif.js';
|
||||
|
||||
const smoke = process.argv.includes('--smoke');
|
||||
@@ -80,4 +81,8 @@ const betaFixture = {
|
||||
width: /** @type {const} */ (640),
|
||||
seed: 7,
|
||||
};
|
||||
await save('gachabeta-5-star.mp4', await renderGachaBetaVideo(betaFixture, {timeoutInMilliseconds: 30000}));
|
||||
try {
|
||||
await save('gachabeta-5-star.mp4', await renderGachaBetaVideo(betaFixture, {timeoutInMilliseconds: 60000}));
|
||||
} finally {
|
||||
await closeGachaBetaBrowser();
|
||||
}
|
||||
Reference in new issue
Block a user