优化座驾特效入场标题
This commit is contained in:
@@ -336,8 +336,9 @@ const J35Effect = (() => {
|
||||
* @param {number} w 画布宽度
|
||||
* @param {number} h 画布高度
|
||||
* @param {number} progress 播放进度
|
||||
* @param {string} title 入场标题
|
||||
*/
|
||||
function drawHud(ctx, w, h, progress) {
|
||||
function drawHud(ctx, w, h, progress, title) {
|
||||
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;
|
||||
@@ -351,7 +352,7 @@ 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 - 230, y - 44, 460, 92, 18);
|
||||
roundRect(ctx, w * 0.5 - 320, y - 46, 640, 96, 18);
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
|
||||
@@ -359,8 +360,8 @@ const J35Effect = (() => {
|
||||
ctx.font = "700 16px serif";
|
||||
ctx.fillText("STEALTH FIGHTER ARRIVAL", w * 0.5, y - 12);
|
||||
ctx.fillStyle = "#ffffff";
|
||||
ctx.font = "900 42px serif";
|
||||
ctx.fillText("中国歼-35 破空入场", w * 0.5, y + 28);
|
||||
ctx.font = "900 38px serif";
|
||||
ctx.fillText(title, w * 0.5, y + 28, 590);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
@@ -393,13 +394,15 @@ const J35Effect = (() => {
|
||||
*
|
||||
* @param {HTMLCanvasElement} canvas 全屏特效画布
|
||||
* @param {Function} onEnd 结束回调
|
||||
* @param {object} options 特效附加参数
|
||||
* @returns {{cancel: Function}}
|
||||
*/
|
||||
function start(canvas, onEnd) {
|
||||
function start(canvas, onEnd, options = {}) {
|
||||
const ctx = canvas.getContext("2d");
|
||||
const w = canvas.width;
|
||||
const h = canvas.height;
|
||||
const speedLines = createSpeedLines(w, h);
|
||||
const title = String(options.effect_title || "中国歼-35 破空入场").trim() || "中国歼-35 破空入场";
|
||||
const startTime = performance.now();
|
||||
let animId = null;
|
||||
let finished = false;
|
||||
@@ -443,7 +446,7 @@ const J35Effect = (() => {
|
||||
drawSpeedLines(ctx, speedLines, w, progress);
|
||||
drawSonicRing(ctx, w, h, progress);
|
||||
drawJet(ctx, jetX, jetY, scale, progress);
|
||||
drawHud(ctx, w, h, progress);
|
||||
drawHud(ctx, w, h, progress, title);
|
||||
|
||||
if (progress < 1) {
|
||||
animId = requestAnimationFrame(animate);
|
||||
|
||||
Reference in New Issue
Block a user