three模拟三维教室场景代码
代码语言:html
所属分类:三维
代码描述:three模拟三维教室场景代码,gpt5.2生成
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Three.js 教室:老师讲课 + 卡通学生(可旋转视角)</title>
<style>
html, body { height: 100%; margin: 0; overflow: hidden; background:#0b1020; }
#hud{
position: fixed; left: 12px; top: 12px; z-index: 10;
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "PingFang SC", "Noto Sans CJK SC", Arial;
color: #e8ecff; font-size: 13px; line-height: 1.4;
background: rgba(10,14,30,.55); border: 1px solid rgba(255,255,255,.12);
padding: 10px 12px; border-radius: 10px; backdrop-filter: blur(6px);
max-width: 320px;
}
#hud b{font-weight:600}
#hud kbd{
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New";
background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
padding: 1px 6px; border-radius: 6px;
}
</style>
</head>
<body>
<div id="hud">
<div><b>教室三维场景</b>(OrbitControls)</div>
<div>鼠标左键旋转 / 右键平移 / 滚轮缩放</div>
<div>快捷键:<kbd>R</kbd> 重置视角</div>
<div style="opacity:.85;margin-top:6px">若打开后黑屏:请用本地服务器运行(如 VSCode Live Server / <kbd>python -m http.server</kbd>)</div>
</div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.156.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/OrbitControls.146.js"></script>
<script type="module">
// ---------- 基础 ----------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x0b1020);
const camera = new THREE.PerspectiveCamera(55, innerWidth / innerHeight.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0