补充座驾动画标题用户信息

This commit is contained in:
pllx
2026-04-30 11:07:46 +08:00
parent 3eaf37a648
commit 7ba7b34ca7
9 changed files with 56 additions and 24 deletions
+11 -6
View File
@@ -337,8 +337,9 @@ const J35Effect = (() => {
* @param {number} h 画布高度
* @param {number} progress 播放进度
* @param {string} title 入场标题
* @param {string} userInfo 用户身份信息
*/
function drawHud(ctx, w, h, progress, title) {
function drawHud(ctx, w, h, progress, title, userInfo) {
const enter = Math.min(1, Math.max(0, (progress - 0.13) / 0.18));
const leave = Math.min(1, Math.max(0, (1 - progress) / 0.16));
const alpha = easeInOutSine(enter) * leave;
@@ -352,16 +353,19 @@ const J35Effect = (() => {
ctx.fillStyle = "rgba(2,6,23,0.62)";
ctx.strokeStyle = "rgba(56,189,248,0.72)";
ctx.lineWidth = 2;
roundRect(ctx, w * 0.5 - 320, y - 46, 640, 96, 18);
roundRect(ctx, w * 0.5 - 340, y - 56, 680, 120, 18);
ctx.fill();
ctx.stroke();
ctx.fillStyle = "#bae6fd";
ctx.font = "700 16px serif";
ctx.fillText("STEALTH FIGHTER ARRIVAL", w * 0.5, y - 12);
ctx.fillText("STEALTH FIGHTER ARRIVAL", w * 0.5, y - 24);
ctx.fillStyle = "#e0f2fe";
ctx.font = "700 18px serif";
ctx.fillText(userInfo, w * 0.5, y + 8, 620);
ctx.fillStyle = "#ffffff";
ctx.font = "900 38px serif";
ctx.fillText(title, w * 0.5, y + 28, 590);
ctx.font = "900 34px serif";
ctx.fillText(title, w * 0.5, y + 45, 620);
ctx.restore();
}
@@ -403,6 +407,7 @@ const J35Effect = (() => {
const h = canvas.height;
const speedLines = createSpeedLines(w, h);
const title = String(options.effect_title || "中国歼-35 破空入场").trim() || "中国歼-35 破空入场";
const userInfo = String(options.effect_user_info || "").trim();
const startTime = performance.now();
let animId = null;
let finished = false;
@@ -446,7 +451,7 @@ const J35Effect = (() => {
drawSpeedLines(ctx, speedLines, w, progress);
drawSonicRing(ctx, w, h, progress);
drawJet(ctx, jetX, jetY, scale, progress);
drawHud(ctx, w, h, progress, title);
drawHud(ctx, w, h, progress, title, userInfo);
if (progress < 1) {
animId = requestAnimationFrame(animate);