three实现三维随机城市生成器代码
代码语言:html
所属分类:三维
代码描述:three实现三维随机城市生成器代码,可模拟不同时间段、不同天气的城市面貌。
下面为部分代码预览,完整代码请点击下载或在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城市模拟 - 建筑设计工具</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Arial, sans-serif;
overflow: hidden;
background: #000;
}
#canvas-container {
width: 100vw;
height: 100vh;
}
/* 控制面板 */
.control-panel {
position: fixed;
top: 20px;
left: 20px;
background: rgba(20, 25, 35, 0.95);
border-radius: 16px;
padding: 20px;
color: #fff;
width: 320px;
max-height: 90vh;
overflow-y: auto;
backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,0.1);
box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.control-panel::-webkit-scrollbar {
width: 6px;
}
.control-panel::-webkit-scrollbar-thumb {
background: rgba(255,255,255,0.2);
border-radius: 3px;
}
.panel-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 1px solid rgba(255,255,255,0.1);
}
.panel-header h2 {
font-size: 18px;
font-weight: 600;
}
.panel-section {
margin-bottom: 20px;
}
.section-title {
font-size: 12px;
text-transform: uppercase;
letter-spacing: 1px;
color: #888;
margin-bottom: 12px;
display: flex;
align-items: center;
gap: 8px;
}
.control-group {
margin-bottom: 15px;
}
.control-group label {
display: block;
font-size: 13px;
margin-bottom: 6px;
color: #ccc;
}
.slider-container {
display: flex;
align-items: center;
gap: 10px;
}
input[type="range"] {
flex: 1;
height: 6px;
-webkit-appearance: none;
background: rgba(255,255,255,0.1);
border-radius: 3px;
outline: none;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 16px;
height: 16px;
background: linear-gradient(135deg, #667eea, #764ba2);
border-radius: 50%;
cursor: pointer;
box-shadow: 0 2px 10px rgba(102,126,234,0.5);
}
.value-display {
min-width: 50px;
text-align: right;
font-size: 13px;
color: #667eea;
font-weight: 600;
}
.btn-group {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
}
.btn {
padding: 10px 15px;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 12px;
font-weight: 500;
transition: all 0.3s;
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
}
.btn-primary {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 5px 20px rgba(102,126,234,0.4);
}
.btn-secondary {
background: rgba(255,255,255,0.1);
color: #ccc;
}
.btn-secondary:hover {
background: rgba(255,255,255,0.2);
}
.btn-secondary.active {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
}
.weather-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px;
}
.weather-btn {
aspect-ratio: 1;
border: 2px solid transparent;
background: rgba(255,255,255,0.05);
border-radius: 12px;
cursor: pointer;
transition: all 0.3s;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
font-size: 20px;
}
.weather-btn span {
font-size: 10px;
color: #888;
}
.weather-btn:hover {
background: rgba(255,255,255,0.1);
}
.weather-btn.active {
border-color: #667eea;
background: rgba(102,126,234,0.2);
}
/* 时间显示 */
.time-display {
text-align: center;
padding: 15px;
background: rgba(255,255,255,0.05);
border-radius: 12px;
margin-bottom: 15px;
}
.current-time {
font-size: 36px;
font-weight: 300;
background: linear-gradient(135deg, #667eea, #764ba2);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.time-period {
font-size: 14px;
color: #888;
margin-top: 5px;
}
/* 统计信息 */
.stats-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
}
.stat-card {
background: rgba(255,255,255,0.05);
border-radius: 10px;
padding: 12px;
text-align: center;
}
.stat-value {
font-size: 24px;
font-weight: 600;
background: linear-gradient(135deg, #667eea, #764ba2);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.stat-label {
font-size: 11px;
color: #888;
margin-top: 4px;
}
/* 建筑工具 */
.building-tools {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
}
.tool-btn {
aspect-ratio: 1;
border: 2px solid transparent;
background: rgba(255,255,255,0.05);
border-radius: 12px;
cursor: pointer;
transition: all 0.3s;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
color: #ccc;
}
.tool-btn:hover {
background: rgba(255,255,255,0.1);
}
.tool-btn.active {
border-color: #667eea;
background: rgba(102,126,234,0.2);
}
.tool-icon {
font-size: 24px;
}
.tool-label {
font-size: 10px;
}
/* 信息面板 */
.info-panel {
position: fixed;
top: 20px;
right: 20px;
background: rgba(20, 25, 35, 0.95);
border-radius: 16px;
padding: 20px;
color: #fff;
width: 280px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,0.1);
}
/* 迷你地图 */
.minimap {
position: fixed;
bottom: 20px;
right: 20px;
width: 200px;
height: 200px;
background: rgba(20, 25, 35, 0.95);
border-radius: 16px;
overflow: hidden;
border: 1px solid rgba(255,255,255,0.1);
}
.minimap canvas {
width: 100%;
height: 100%;
}
/* 加载屏幕 */
.loading-screen {
position: fixed;
top: 0;
left: 0;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0