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

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
+1
View File
@@ -484,6 +484,7 @@ export function bindChatEvents() {
const myName = window.chatContext?.username;
const effectOptions = {
effect_title: e.detail?.effect_title,
effect_user_info: e.detail?.effect_user_info,
ride_name: e.detail?.ride_name,
operator,
};
+11 -6
View File
@@ -447,8 +447,9 @@ const Type99AEffect = (() => {
* @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.14) / 0.2));
const leave = Math.min(1, Math.max(0, (1 - progress) / 0.16));
const alpha = easeInOutSine(enter) * leave;
@@ -462,16 +463,19 @@ const Type99AEffect = (() => {
ctx.fillStyle = "rgba(28,25,23,0.66)";
ctx.strokeStyle = "rgba(253,230,138,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 = "#fef3c7";
ctx.font = "700 16px serif";
ctx.fillText("ZTZ-99A ARMORED FORCE", w * 0.5, y - 12);
ctx.fillText("ZTZ-99A ARMORED FORCE", w * 0.5, y - 24);
ctx.fillStyle = "#fde68a";
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();
}
@@ -513,6 +517,7 @@ const Type99AEffect = (() => {
const h = canvas.height;
const dust = createDust(w, h);
const title = String(options.effect_title || "99A主战坦克 重装入场").trim() || "99A主战坦克 重装入场";
const userInfo = String(options.effect_user_info || "").trim();
const startTime = performance.now();
let animId = null;
let finished = false;
@@ -556,7 +561,7 @@ const Type99AEffect = (() => {
drawDust(ctx, dust, w, progress);
drawShockwave(ctx, w, h, progress);
drawTank(ctx, tankX, tankY, scale, progress);
drawHud(ctx, w, h, progress, title);
drawHud(ctx, w, h, progress, title, userInfo);
if (progress < 1) {
animId = requestAnimationFrame(animate);
+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);
+11 -6
View File
@@ -394,8 +394,9 @@ const FujianEffect = (() => {
* @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.12) / 0.2));
const leave = Math.min(1, Math.max(0, (1 - progress) / 0.14));
const alpha = easeInOutCubic(enter) * leave;
@@ -407,17 +408,20 @@ const FujianEffect = (() => {
ctx.fillStyle = "rgba(15,23,42,0.68)";
ctx.strokeStyle = "rgba(103,232,249,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.shadowColor = "rgba(103,232,249,0.95)";
ctx.shadowBlur = 20;
ctx.fillStyle = "#cffafe";
ctx.font = "700 16px serif";
ctx.fillText("FUJIAN AIRCRAFT CARRIER PREVIEW", w * 0.5, y - 12);
ctx.fillText("FUJIAN AIRCRAFT CARRIER PREVIEW", w * 0.5, y - 24);
ctx.fillStyle = "#a5f3fc";
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();
}
@@ -459,6 +463,7 @@ const FujianEffect = (() => {
const h = canvas.height;
const waves = createWaves(w, h);
const title = String(options.effect_title || "福建舰 航母入场").trim() || "福建舰 航母入场";
const userInfo = String(options.effect_user_info || "").trim();
const startTime = performance.now();
let animId = null;
let finished = false;
@@ -500,7 +505,7 @@ const FujianEffect = (() => {
drawBackdrop(ctx, w, h, progress);
drawWaves(ctx, waves, w, progress, carrierX, carrierY, scale);
drawCarrier(ctx, carrierX, carrierY, scale, progress);
drawHud(ctx, w, h, progress, title);
drawHud(ctx, w, h, progress, title, userInfo);
if (progress < 1) {
animId = requestAnimationFrame(animate);
+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);