three实现三维打雪仗游戏代码
代码语言:html
所属分类:其他
代码由glm-5.3-flash ai生成,可能有错误,仅供参考:点击查看提示词
代码描述:三维打雪仗游戏
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>雪原打雪仗 · 3D Snowball Fight</title>
<style>
/* ============ 基础样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
background: #0b1220; color: #eaf2ff;
user-select: none; -webkit-user-select: none;
}
canvas { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }
/* ============ 毛玻璃面板 ============ */
.glass {
background: rgba(13, 24, 46, 0.48);
backdrop-filter: blur(12px) saturate(1.2);
-webkit-backdrop-filter: blur(12px) saturate(1.2);
border: 1px solid rgba(255, 255, 255, 0.16);
border-radius: 14px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
/* ============ HUD ============ */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#panelStats { position: absolute; top: 16px; left: 16px; padding: 12px 16px; min-width: 248px; }
.hpRow { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hpLabel { font-size: 12px; opacity: .8; white-space: nowrap; }
#hpBar { position: relative; flex: 1; height: 16px; background: rgba(255,255,255,.12); border-radius: 8px; overflow: hidden; }
#hpFill { height: 100%; width: 100%; background: linear-gradient(90deg, #4fb3ff, #9fe6ff); border-radius: 8px; transition: width .18s ease; }
#hpFill.low { background: linear-gradient(90deg, #ff5f6d, #ffb37f); animation: hpPulse 1s infinite; }
@keyframes hpPulse { 50% { filter: brightness(1.35); } }
#hpText { font-size: 12px; font-weight: 700; min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.statLine { display: flex; justify-content: space-between; font-size: 13px; line-height: 1.75; opacity: .92; }
.statLine b { font-variant-numeric: tabular-nums; }
#panelTime {
position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
padding: 8px 22px; font-size: 20px; font-weight: 700; letter-spacing: 2px;
font-variant-numeric: tabular-nums;
}
/* ============ 准星 ============ */
#crosshair {
position: absolute; left: 50%; top: 50%; width: 28px; height: 28px;
transform: translate(-50%, -50%) scale(var(--s, 1));
z-index: 6; display: none;
}
#crosshair .bar { position: absolute; background: rgba(255,255,255,.9); box-shadow: 0 0 4px rgba(0,0,0,.5); transition: background .12s; }
#crosshair .t { left: 13px; top: 0; width: 2px; height: 7px; }
#crosshair .b { left: 13px; bottom: 0; width: 2px; height: 7px; }
#crosshair .l { left: 0; top: 13px; width: 7px; height: 2px; }
#crosshair .r { right: 0; top: 13px; width: 7px; height: 2px; }
#crosshair .dot { position: absolute; left: 12.5px; top: 12.5px; width: 3px; height: 3px; border-radius: 50%; background: rgba(255,255,255,.95); transition: background .12s; }
#crosshair.hot .bar, #crosshair.hot .dot { background: #ffb14d; box-shadow: 0 0 6px rgba(255,150,40,.8); }
#fps { position: absolute; right: 14px; bottom: 12px; font-size: 11px; opacity: .45; font-variant-numeric: tabular-nums; }
#hint {
position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
padding: 7px 18px; font-size: 13px; opacity: .85;
}
#hint b { color: #9fd4ff; }
/* ============ 飘分文字 / 受伤红晕 ============ */
#floatLayer { position: absolute; inset: 0; overflow: hidden; }
.float {
position: absolute; font-size: 20px; font-weight: 800;
text-shadow: 0 2px 10px rgba(0,0,0,.45);
animation: floatUp .85s ease-out forwards; pointer-events: none;
}
@keyframes floatUp {
from { transform: translate(-50%, 0); opacity: 1; }
to { transform: translate(-50%, -60px); opacity: 0; }
}
#vignette {
position: absolute; inset: 0; opacity: 0; z-index: 4;
box-shadow: inset 0 0 140px 48px rgba(255, 42, 42, .8);
}
/* ============ 覆盖层(开始 / 暂停 / 结算) ============ */
.overlay {
position: fixed; inset: 0; z-index: 10;
display: flex; align-items: center; justify-content: center;
background: rgba(6, 12, 26, .5);
backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.card { padding: 36px 48px; text-align: center; max-width: 580px; pointer-events: auto; }
.card h1 { font-size: 42px; letter-spacing: 4px; margin-bottom: 6px; text-shadow: 0 4px 18px rgba(80,160,255,.35); }
.card h2 { font-size: 30px; margin-bottom: 10px; }
.card .sub { font-size: 13px; opacity: .75; letter-spacing: 3px; margin-bottom: 22px; }
.ctrlGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; margin: 0 0 24px; }
.ctrlGrid > div {
background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
border-radius: 10px; padding: 10px 6px;
display: flex; flex-direction: column; align-items: center; gap: 6px;
}
kbd {
font-family: inherit; font-size: 12px; font-weight: 700;
background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
border-bottom-width: 2px; border-radius: 6px; padding: 3px 8px;
}
.ctrlGrid span { font-size: 12px; opacity: .8; }
.btn {
display: inline-block; border: none; cursor: pointer; font-family: inherit;
font-size: 18px; font-weight: 700; letter-spacing: 2px; color: #fff;
background: linear-gradient(135deg, #3e8ef7, #6fd0ff);
border-radius: 12px; padding: 13px 46px;
box-shadow: 0 6px 20px rgba(70, 150, 255, .35);
transition: transform .12s, filter .12s;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn.ghost {
background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
box-shadow: none; font-size: 15px; padding: 11px 26px;
}
.btnRow { display: flex; gap: 12px; justify-content: center; }
.tip { margin-top: 16px; font-size: 12px; opacity: .55; }
.finals { margin: 6px 0 22px; display: flex; flex-direction: column; gap: 8px; }
.finalRow { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,.06); border-radius: 10px; padding: 10px 16px; font-size: 14px; }
.finalRow b { .........完整代码请登录后点击上方下载按钮下载查看















网友评论0