three实现小船河流行驶躲避桥梁游戏代码
代码语言:html
所属分类:其他
代码描述:3d小船行驶躲避桥梁游戏
代码标签: three 小船 河流 行驶 躲避 桥梁 游戏 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>小河驾船 · Three.js 3D Game</title>
<style>
html, body {
margin: 0; padding: 0; height: 100%; width: 100%;
background: #0a1828; font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
overflow: hidden; color: #fff;
user-select: none;
}
#game { position: fixed; inset: 0; }
canvas { display: block; }
/* HUD */
#hud {
position: fixed; top: 16px; left: 16px; right: 16px;
display: flex; justify-content: space-between; align-items: flex-start;
pointer-events: none; z-index: 5;
}
.panel {
background: rgba(8, 20, 35, 0.55);
backdrop-filter: blur(8px);
border: 1px solid rgba(120, 200, 255, 0.25);
border-radius: 10px;
padding: 10px 14px;
font-size: 14px;
line-height: 1.7;
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.panel .k { color: #6ec1ff; font-weight: 600; }
.panel .v { color: #fff; font-weight: 700; }
.panel.right { text-align: right; }
.panel .title { color: #a0d8ff; font-size: 12px; letter-spacing: 1px; margin-bottom: 4px; }
/* 倒计时 & 提示 */
#notice {
position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
font-size: 64px; font-weight: 900; letter-spacing: 4px;
text-shadow: 0 4px 30px rgba(0,0,0,0.5);
pointer-events: none; z-index: 8;
opacity: 0; transition: opacity 0.25s, transform 0.25s;
}
#notice.show { opacity: 1; }
#toast {
position: fixed; top: 22%; left: 50%; transform: translateX(-50%);
background: rgba(255, 90, 60, 0.92);
padding: 10px 20px; border-radius: 30px;
font-weight: 700; font-size: 16px; letter-spacing: 1px;
box-shadow: 0 6px 20px rgba(255, 90, 60, 0.4);
pointer-events: none; z-index: 9;
opacity: 0; transition: opacity 0.2s;
}
#toast.show { opacity: 1; }
#toast.ok { background: rgba(80, 200, 120, 0.92); box-shadow: 0 6px 20px rgba(80,200,120,0.4); }
/* 开始 / 结束界面 */
#overlay {
position: fixed; inset: 0; background: rgba(5,15,30,0.78);
backdrop-filter: blur(6px);
display: flex; align-items: center; justify-content: center;
z-index: 20; transition: opacity 0.4s;
}
#overlay.hidden { opacity: 0; pointer-events: none; }
#overlay .card {
background: linear-gradient(160deg, #0e2740, #061827);
border: 1px solid rgba(120,200,255,0.3);
border-radius: 16px;
padding: 36px 48px;
text-align: center;
max-width: 460px;
box-shadow: 0 20px .........完整代码请登录后点击上方下载按钮下载查看















网友评论0