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

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
@@ -270,8 +270,9 @@ const Df5cEffect = (() => {
* @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.1) / 0.18));
const leave = Math.min(1, Math.max(0, (1 - progress) / 0.14));
const alpha = easeInOutCubic(enter) * leave;
@@ -283,17 +284,20 @@ const Df5cEffect = (() => {
ctx.fillStyle = "rgba(15,23,42,0.68)";
ctx.strokeStyle = "rgba(248,113,113,0.72)";
ctx.lineWidth = 2;
roundRect(ctx, w * 0.5 - 330, y - 46, 660, 96, 18);
roundRect(ctx, w * 0.5 - 350, y - 56, 700, 120, 18);
ctx.fill();
ctx.stroke();
ctx.shadowColor = "rgba(248,113,113,0.95)";
ctx.shadowBlur = 22;
ctx.fillStyle = "#fee2e2";
ctx.font = "700 16px serif";
ctx.fillText("DF-5C STRATEGIC LAUNCH PREVIEW", w * 0.5, y - 12);
ctx.fillText("DF-5C STRATEGIC LAUNCH PREVIEW", w * 0.5, y - 24);
ctx.fillStyle = "#fecaca";
ctx.font = "700 18px serif";
ctx.fillText(userInfo, w * 0.5, y + 8, 640);
ctx.fillStyle = "#ffffff";
ctx.font = "900 38px serif";
ctx.fillText(title, w * 0.5, y + 28, 610);
ctx.font = "900 34px serif";
ctx.fillText(title, w * 0.5, y + 45, 640);
ctx.restore();
}
@@ -335,6 +339,7 @@ const Df5cEffect = (() => {
const h = canvas.height;
const particles = createParticles(120);
const title = String(options.effect_title || "东风-5C 洲际导弹 升空").trim() || "东风-5C 洲际导弹 升空";
const userInfo = String(options.effect_user_info || "").trim();
const startTime = performance.now();
let animId = null;
let finished = false;
@@ -378,7 +383,7 @@ const Df5cEffect = (() => {
drawLaunchPad(ctx, w, h, progress);
drawExhaust(ctx, particles, tailX, tailY, progress);
drawMissile(ctx, launchX, launchY, scale, progress);
drawHud(ctx, w, h, progress, title);
drawHud(ctx, w, h, progress, title, userInfo);
if (progress < 1) {
animId = requestAnimationFrame(animate);