js+css模拟自然界生态系统代码
代码语言:html
所属分类:其他
代码描述:模拟自然界生态系统网页
下面为部分代码预览,完整代码请点击下载或在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>🌿 生态系统模拟器 · Ecosystem Simulator</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg-0: #0a0e14;
--bg-1: #131a24;
--bg-2: #1c2533;
--bg-3: #2a3648;
--line: #2f3a4c;
--text: #e6edf3;
--text-dim: #8b97a8;
--accent: #6ee7b7;
--accent-2: #fbbf24;
--danger: #f87171;
--info: #60a5fa;
}
html, body {
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
color: var(--text);
background: radial-gradient(ellipse at top, #1a2332 0%, var(--bg-0) 60%);
overflow-x: hidden;
}
.app {
max-width: 1500px;
margin: 0 auto;
padding: 16px;
}
header {
display: flex;
align-items: baseline;
justify-content: space-between;
margin-bottom: 14px;
flex-wrap: wrap;
gap: 8px;
}
header h1 {
font-size: 22px;
font-weight: 700;
background: linear-gradient(90deg, #6ee7b7, #60a5fa, #c084fc);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
letter-spacing: 0.5px;
}
header .sub {
color: var(--text-dim);
font-size: 13px;
}
.layout {
display: grid;
grid-template-columns: 1fr 320px;
gap: 14px;
}
@media (max-width: 1000px) {
.layout { grid-template-columns: 1fr; }
}
.stage {
background: var(--bg-1);
border: 1px solid var(--line);
border-radius: 12px;
overflow: hidden;
position: relative;
box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
#canvas { display: block; width: 100%; height: auto; background: #0d141d; }
.stage .overlay {
position: absolute;
top: 10px; left: 10px;
background: rgba(10,14,20,0.7);
border: 1px solid var(--line);
padding: 8px 12px;
border-radius: 8px;
font-size: 12px;
color: var(--text-dim);
backdrop-filter: blur(6px);
line-height: 1.6;
pointer-events: none;
}
.stage .overlay b { color: var(--text); }
.stage .controls-bar {
position: absolute;
bottom: 10px; left: 10px; right: 10px;
display: flex; gap: 8px; flex-wrap: wrap;
pointer-events: auto;
}
.btn {
background: var(--bg-3);
color: var(--text);
border: 1px solid var(--line);
padding: 7px 14px;
border-radius: 8px;
font-size: 13px;
cursor: pointer;
transition: all 0.15s;
user-select: none;
}
.btn:hover { background: #38445a; border-color: #4a5a73; }
.btn.primary { background: linear-gradient(135deg, #10b981, #059669); border-color: #10b981; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #b91c1c); border-color: #ef4444; }
.btn.warn { background: linear-gradient(135deg, #f59e0b, #d97706); border-color: #f59e0b; }
.btn.ghost { background: transparent; }
aside.panel {
background: var(--bg-1);
border: 1px solid var(--line);
border-radius: 12px;
padding: 6px;
max-height: 720px;
overflow-y: auto;
box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
aside::-webkit-scrollbar { width: 6px; }
aside::-webkit-scrollbar-track { background: transparent; }
aside::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
.section {
border-bottom: 1px solid var(--line);
padding: 12px;
}
.section:last-child { border-bottom: none; }
.section h3 {
font-size: 12px;
text-transform: uppercase;
letter-spacing: 1.2px;
color: var(--accent);
margin-bottom: 10px;
display: flex;
align-items: center;
gap: 6px;
}
.row {
display: flex; align-items: center; justify-content: space-between;
margin-bottom: 8px;
gap: 10px;
}
.row:last-child { margin-bottom: 0; }
.row label { font-size: 12px; color: var(--text-dim); flex-shrink: 0; min-width: 80px; }
.row input[type=range] {
flex: 1;
-webkit-appearance: none;
appearance: none;
background: transparent;
height: 18px;
}
.row input[type=range]::-webkit-slider-runnable-track {
background: var(--bg-3);
height: 4px;
border-radius: 2px;
}
.row input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
.........完整代码请登录后点击上方下载按钮下载查看















网友评论0