three实现炫酷三维黑洞模拟运行动画效果代码
代码语言:html
所属分类:三维
代码描述:three实现炫酷三维黑洞模拟运行动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
overflow: hidden;
background-color: #000003;
color: #fff;
font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
canvas {
display: block;
width: 100%;
height: 100%;
}
#info {
position: absolute;
top: 15px;
width: 100%;
text-align: center;
color: rgba(255, 255, 255, 0.9);
font-size: 18px;
letter-spacing: 0.5px;
pointer-events: none;
z-index: 100;
text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
transition: opacity 1.5s ease-in-out 1s;
}
.ui-panel {
position: absolute;
background-color: rgba(25, 30, 50, 0.5);
backdrop-filter: blur(10px) saturate(180%);
-webkit-backdrop-filter: blur(10px) saturate(180%);
padding: 12px 15px;
border-radius: 10px;
border: 1px solid rgba(255, 255, 255, 0.1);
color: rgba(220, 220, 255, 0.9);
font-size: 14px;
user-select: none;
z-index: 50;
opacity: 0.8;
transition: opacity 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease, bottom 0.3s ease;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 8px;
}
.ui-panel:hover {
opacity: 1;
background-color: rgba(35, 40, 60, 0.6);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
#controls {
bottom: 20px;
right: 20px;
align-items: flex-start;
}
.control-item {
cursor: pointer;
padding: 5px;
display: flex;
align-items: center;
gap: 6px;
width: 100%;
transition: color 0.2s ease;
}
.control-item:hover {
color: #fff;
}
#theme-changer {
bottom: 20px;
left: 20px;
display: flex;
flex-direction: column;
gap: 8px;
}
#theme-changer h4 {
margin: 0 0 5px 0;
font-weight: 500;
font-size: 13px;
color: rgba(200, 200, 230, 0.8);
text-align: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
padding-bottom: 5px;
}
#theme-buttons {
display: flex;
gap: 8px;
flex-wrap: wrap;
justify-content: center;
}
.theme-button {
padding: 6px 12px;
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 6px;
background-color: rgba(255, 255, 255, 0.1);
color: rgba(220, 220, 255, 0.85);
cursor: pointer;
font-size: 12px;
transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
text-align: center;
}
.theme-button:hover {
background-color: rgba(255, 255, 255, 0.2);
border-color: rgba(255, 255, 255, 0.4);
}
.theme-button.active {
background-color: rgba(120, 120, 255, 0.3);
border-color: rgba(150, 150, 255, 0.6);
color: #fff;
font-weight: 500;
transform: scale(1.02);
}
.theme-button:active {
transform: scale(0.98);
}
.ui-icon {
width: 1em;
height: 1em;
stroke: currentColor;
stroke-width: 2;
fill: none;
stroke-linecap: round;
stroke-linejoin: round;
}
@media (max-width: 640px) {
.ui-panel {
padding: 10px 12px;
}
#controls {
bottom: 105px;
right: 15px;
max-width: calc(50% - 25px);
min-width: 140px;
}
#theme-changer {
bottom: 15px;
left: 15px;
max-width: calc(50% - 25px);
min-width: 130px;
}
#theme-buttons {
justify-content: flex-start;
}
.theme-button {
padding: 5px 10px;
font-size: 11px;
}
#info {
font-size: 16px;
}
#info span {
font-size: 12px;
}
}
@media (max-width: 380px) {
#controls {
bottom: auto;
top: 15px;
right: 15px;
left: auto;
max-width: calc(100% - 30px);
}
#theme-changer {
bottom: 15px;
left: 15px;
right: 15px;
max-width: none;
width: calc(100% - 30px);
}
#theme-buttons {
justify-content: center;
}
}
</style>
</head>
<body>
<div id="info">
Galactic Black Hole<br>
<span style="font-size: 14px; opacity: 0.8;">Click core or button for Disk Echo. Drag to rotate.</span>
</div>
<div id="controls" class="ui-panel">
<div id="autoRotateToggle" class="control-item" title="Toggle automatic rotation">
</div>
<div id=".........完整代码请登录后点击上方下载按钮下载查看
















网友评论0