细节调整

This commit is contained in:
kron
2025-06-28 13:42:26 +08:00
parent af9ef91dc3
commit 770c0c42bb
3 changed files with 13 additions and 9 deletions

View File

@@ -85,7 +85,7 @@ export function renderRankTitle(ctx, text) {
const textY = 50;
const x = textX - padding - 10; // 文字 x 坐标减去内边距
const y = textY - fontSize - padding / 2 + 2; // 文字 y 坐标减去字体大小和内边距
const width = textWidth + padding * 2 - 27; // 背景宽度
const width = textWidth + padding * 2 - 25; // 背景宽度
const height = fontSize + padding - 2; // 背景高度
// 开始绘制圆角矩形
@@ -109,6 +109,7 @@ export function renderRankTitle(ctx, text) {
ctx.fillStyle = "#5F51FF";
ctx.fill();
ctx.setFontSize(fontSize);
ctx.setTextAlign("center");
ctx.setFillStyle("rgba(255, 255, 255, 0.9)");
ctx.fillText(text, textX, textY); // 绘制文字
}
@@ -156,8 +157,8 @@ export function generateCanvasImage(canvasId, type, user, data) {
ctx.drawImage("../static/share-bg.png", 0, 0, width, height);
drawRoundImage(ctx, user.avatar, 17, 20, 32, 32, 20);
ctx.drawImage("../static/avatar-frame.png", 12, 15, 42, 42);
renderText(ctx, user.nickName, 13, "#fff", 72, 34, "center");
renderRankTitle(ctx, user.lvlName, "center");
renderText(ctx, user.nickName, 13, "#fff", 58, 34);
renderRankTitle(ctx, user.lvlName);
let titleImage = "../static/first-try-title.png";
let subTitle = "正式开启弓箭手之路";