Files
obs-lowerthird/public/verify-preset.html
T
2026-03-16 18:10:55 +08:00

598 lines
16 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>验证几何动画预设集成</title>
<style>
body {
font-family: system-ui, sans-serif;
margin: 20px;
background: #1a1a2e;
color: #fff;
}
.container {
max-width: 800px;
margin: 0 auto;
}
h1 {
color: #ff69b4;
text-align: center;
}
.status {
padding: 15px;
border-radius: 8px;
margin: 20px 0;
text-align: center;
font-weight: bold;
}
.success {
background: rgba(0, 255, 136, 0.1);
border: 2px solid #00ff88;
color: #00ff88;
}
.error {
background: rgba(255, 69, 0, 0.1);
border: 2px solid #ff4500;
color: #ff4500;
}
.info {
background: rgba(0, 191, 255, 0.1);
border: 2px solid #00bfff;
color: #00bfff;
}
.preset-preview {
width: 100%;
height: 200px;
border: 2px solid #333;
border-radius: 10px;
overflow: hidden;
background: #000;
margin: 20px 0;
}
.controls {
display: flex;
gap: 10px;
margin: 20px 0;
}
button {
padding: 10px 20px;
border: none;
border-radius: 6px;
background: linear-gradient(135deg, #ff69b4, #00bfff);
color: white;
font-weight: bold;
cursor: pointer;
flex: 1;
}
button:hover {
opacity: 0.9;
}
.preset-info {
background: rgba(255, 255, 255, 0.05);
padding: 20px;
border-radius: 10px;
margin-top: 20px;
}
.preset-info h3 {
color: #ff69b4;
margin-top: 0;
}
.preset-details {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
margin-top: 15px;
}
.detail-item {
background: rgba(255, 255, 255, 0.03);
padding: 10px;
border-radius: 6px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.detail-label {
font-size: 12px;
opacity: 0.7;
margin-bottom: 5px;
}
.detail-value {
font-size: 14px;
font-weight: 600;
}
</style>
</head>
<body>
<div class="container">
<h1>几何动画预设集成验证</h1>
<div id="serverStatus" class="status info">
正在检查服务器状态...
</div>
<div id="presetStatus" class="status info">
正在检查预设集成...
</div>
<div class="controls">
<button onclick="checkServer()">检查服务器</button>
<button onclick="loadPreset()">加载预设</button>
<button onclick="showPresetInfo()">显示预设信息</button>
</div>
<div class="preset-preview" id="previewFrame">
<!-- 预设将在这里显示 -->
</div>
<div class="preset-info" id="presetInfo" style="display: none;">
<h3>几何动画预设详情</h3>
<div class="preset-details" id="presetDetails">
<!-- 预设详情将在这里显示 -->
</div>
</div>
</div>
<script>
// 几何动画预设的HTML内容(从server.js中提取)
const geometricPresetHTML = `<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
font-family: system-ui, -apple-system, sans-serif;
color: #fff;
background: transparent;
}
.lt-root {
position: relative;
width: 100%;
height: 100%;
padding: 15px 20px;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: flex-end;
}
.geometric-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
.geo-shape {
position: absolute;
opacity: 0.4;
filter: blur(0.5px);
mix-blend-mode: screen;
animation: floatGeo 8s infinite ease-in-out;
}
@keyframes floatGeo {
0%, 100% {
transform: translate(0, 0) rotate(0deg);
}
50% {
transform: translate(10px, -15px) rotate(180deg);
}
}
.lt-container {
position: relative;
z-index: 1;
background: rgba(15, 20, 30, 0.9);
backdrop-filter: blur(15px);
border-radius: 14px;
padding: 18px 22px;
border: 1px solid rgba(255, 255, 255, 0.15);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
max-width: 380px;
min-width: 300px;
transition: all 0.3s ease;
}
.lt-container:hover {
transform: translateY(-2px);
box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.lt-header {
display: flex;
align-items: center;
margin-bottom: 12px;
}
.geo-icon {
width: 32px;
height: 32px;
background: linear-gradient(135deg, #ff69b4, #00bfff);
border-radius: 8px;
margin-right: 10px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
animation: rotateIcon 6s infinite linear;
}
.geo-icon span {
transform: rotate(-45deg);
}
@keyframes rotateIcon {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.lt-title {
font-size: 20px;
font-weight: 700;
background: linear-gradient(90deg, #ff69b4, #00bfff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 2px;
}
.lt-tag {
font-size: 11px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: #00bfff;
font-weight: 600;
}
.lt-description {
font-size: 13px;
line-height: 1.5;
opacity: 0.9;
margin-bottom: 16px;
}
.lt-features {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
margin-bottom: 16px;
}
.lt-feature {
background: rgba(255, 255, 255, 0.05);
border-radius: 8px;
padding: 10px;
border: 1px solid rgba(255, 255, 255, 0.08);
}
.lt-feature-title {
font-size: 12px;
font-weight: 600;
margin-bottom: 4px;
}
.lt-feature-desc {
font-size: 10px;
opacity: 0.7;
line-height: 1.3;
}
.lt-status {
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.status-dot {
width: 6px;
height: 6px;
background: #00ff88;
border-radius: 50%;
animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.status-text {
font-size: 11px;
opacity: 0.8;
}
.lt-time {
font-size: 10px;
opacity: 0.6;
}
</style>
</head>
<body>
<div class="lt-root">
<div class="geometric-bg" id="geoContainer"></div>
<div class="lt-container">
<div class="lt-header">
<div class="geo-icon"><span>◈</span></div>
<div>
<div class="lt-title">几何动画预设</div>
<div class="lt-tag">GEOMETRIC PRESET</div>
</div>
</div>
<div class="lt-description">
动态几何图形动画效果,包含多种形状的浮动动画,适合科技展示和创意直播。
</div>
<div class="lt-features">
<div class="lt-feature">
<div class="lt-feature-title">动态图形</div>
<div class="lt-feature-desc">多种几何形状浮动动画</div>
</div>
<div class="lt-feature">
<div class="lt-feature-title">渐变色彩</div>
<div class="lt-feature-desc">彩虹渐变配色方案</div>
</div>
<div class="lt-feature">
<div class="lt-feature-title">3D效果</div>
<div class="lt-feature-desc">CSS 3D变换动画</div>
</div>
<div class="lt-feature">
<div class="lt-feature-title">实时交互</div>
<div class="lt-feature-desc">鼠标悬停响应效果</div>
</div>
</div>
<div class="lt-status">
<div style="display: flex; align-items: center; gap: 6px;">
<div class="status-dot"></div>
<div class="status-text">动画运行中</div>
</div>
<div class="lt-time" id="timeDisplay">15:30</div>
</div>
</div>
</div>
<script>
function updateTime() {
const now = new Date();
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
document.getElementById('timeDisplay').textContent = \`\${hours}:\${minutes}\`;
}
function createGeometry() {
const container = document.getElementById('geoContainer');
const shapes = ['circle', 'square', 'triangle'];
const colors = [
'rgba(255,105,180,0.25)',
'rgba(0,191,255,0.25)',
'rgba(50,205,50,0.25)',
'rgba(255,215,0,0.25)',
'rgba(138,43,226,0.25)'
];
for (let i = 0; i < 10; i++) {
const shape = document.createElement('div');
shape.className = 'geo-shape';
const shapeType = shapes[Math.floor(Math.random() * shapes.length)];
const color = colors[Math.floor(Math.random() * colors.length)];
const size = Math.random() * 60 + 20;
const left = Math.random() * 100;
const top = Math.random() * 100;
const duration = Math.random() * 6 + 4;
const delay = Math.random() * 2;
shape.style.width = \`\${size}px\`;
shape.style.height = \`\${size}px\`;
shape.style.left = \`\${left}%\`;
shape.style.top = \`\${top}%\`;
shape.style.animationDelay = \`\${delay}s\`;
shape.style.animationDuration = \`\${duration}s\`;
if (shapeType === 'triangle') {
shape.style.width = '0';
shape.style.height = '0';
shape.style.borderLeft = \`\${size/2}px solid transparent\`;
shape.style.borderRight = \`\${size/2}px solid transparent\`;
shape.style.borderBottom = \`\${size}px solid \${color}\`;
shape.style.background = 'none';
} else if (shapeType === 'circle') {
shape.style.borderRadius = '50%';
shape.style.background = \`radial-gradient(circle, \${color}, transparent 70%)\`;
} else {
shape.style.borderRadius = '8px';
shape.style.background = color;
}
container.appendChild(shape);
}
}
document.addEventListener('DOMContentLoaded', function() {
updateTime();
createGeometry();
setInterval(updateTime, 60000);
});
</script>
</body>
</html>`;
// 检查服务器状态
async function checkServer() {
const statusDiv = document.getElementById('serverStatus');
statusDiv.className = 'status info';
statusDiv.textContent = '正在检查服务器状态...';
try {
const response = await fetch('/health');
if (response.ok) {
statusDiv.className = 'status success';
statusDiv.textContent = '✅ 服务器运行正常';
// 检查预设
checkPresetIntegration();
} else {
statusDiv.className = 'status error';
statusDiv.textContent = '❌ 服务器响应异常';
}
} catch (error) {
statusDiv.className = 'status error';
statusDiv.textContent = '❌ 无法连接到服务器';
console.error('服务器检查失败:', error);
}
}
// 检查预设集成
async function checkPresetIntegration() {
const statusDiv = document.getElementById('presetStatus');
statusDiv.className = 'status info';
statusDiv.textContent = '正在检查预设集成...';
try {
const response = await fetch('/api/presets');
if (response.ok) {
const presets = await response.json();
const geometricPreset = presets.find(p => p.name === '几何动画预设');
if (geometricPreset) {
statusDiv.className = 'status success';
statusDiv.textContent = `✅ 几何动画预设已成功集成 (第${presets.indexOf(geometricPreset) + 1}个预设)`;
} else {
statusDiv.className = 'status error';
statusDiv.textContent = '❌ 未找到几何动画预设';
}
} else {
statusDiv.className = 'status error';
statusDiv.textContent = '❌ 无法获取预设列表';
}
} catch (error) {
statusDiv.className = 'status error';
statusDiv.textContent = '❌ 检查预设集成失败';
console.error('预设检查失败:', error);
}
}
// 加载预设到预览框
function loadPreset() {
const previewFrame = document.getElementById('previewFrame');
previewFrame.innerHTML = '';
const iframe = document.createElement('iframe');
iframe.style.width = '100%';
iframe.style.height = '100%';
iframe.style.border = 'none';
iframe.sandbox = 'allow-scripts allow-same-origin';
previewFrame.appendChild(iframe);
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
iframeDoc.open();
iframeDoc.write(geometricPresetHTML);
iframeDoc.close();
// 更新状态
const statusDiv = document.getElementById('presetStatus');
statusDiv.className = 'status success';
statusDiv.textContent = '✅ 几何动画预设已加载到预览框';
}
// 显示预设信息
function showPresetInfo() {
const presetInfo = document.getElementById('presetInfo');
const presetDetails = document.getElementById('presetDetails');
const presetData = {
name: '几何动画预设',
description: '动态几何图形动画,包含多种形状的浮动效果',
kind: 'geometric',
align: 'right',
features: [
'动态几何图形动画',
'多种形状浮动效果',
'渐变色彩方案',
'3D变换动画',
'实时交互效果',
'响应式设计'
],
shapes: ['圆形', '方形', '三角形'],
colors: ['粉色渐变', '蓝色渐变', '绿色渐变', '黄色渐变', '紫色渐变'],
animations: ['浮动动画', '旋转动画', '脉冲效果', '3D变换']
};
// 生成详情HTML
let detailsHTML = '';
detailsHTML += `
<div class="detail-item">
<div class="detail-label">预设名称</div>
<div class="detail-value">${presetData.name}</div>
</div>
<div class="detail-item">
<div class="detail-label">预设类型</div>
<div class="detail-value">${presetData.kind}</div>
</div>
<div class="detail-item">
<div class="detail-label">对齐方式</div>
<div class="detail-value">${presetData.align}</div>
</div>
<div class="detail-item">
<div class="detail-label">几何形状</div>
<div class="detail-value">${presetData.shapes.join(', ')}</div>
</div>
<div class="detail-item">
<div class="detail-label">颜色方案</div>
<div class="detail-value">${presetData.colors.join(', ')}</div>
</div>
<div class="detail-item">
<div class="detail-label">动画效果</div>
<div class="detail-value">${presetData.animations.join(', ')}</div>
</div>
`;
presetDetails.innerHTML = detailsHTML;
presetInfo.style.display = 'block';
// 滚动到详情区域
presetInfo.scrollIntoView({ behavior: 'smooth' });
}
// 页面加载时自动检查
window.onload = function() {
checkServer();
};
</script>
</body>
</html>