就绪
`; function loadGeometricPreset() { const container = document.getElementById('widgetContainer'); container.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'; container.appendChild(iframe); currentIframe = iframe; const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; iframeDoc.open(); iframeDoc.write(geometricPresetHTML); iframeDoc.close(); document.getElementById('status').textContent = '几何动画预设已加载'; document.getElementById('status').style.color = '#00ff88'; } function reloadPreset() { if (currentIframe) { const iframeDoc = currentIframe.contentDocument || currentIframe.contentWindow.document; iframeDoc.open(); iframeDoc.write(geometricPresetHTML); iframeDoc.close(); document.getElementById('status').textContent = '预设已重新加载'; document.getElementById('status').style.color = '#00bfff'; } } function toggleAnimation() { if (!currentIframe) return; const iframeDoc = currentIframe.contentDocument || currentIframe.contentWindow.document; const shapes = iframeDoc.querySelectorAll('.geo-shape'); animationPaused = !animationPaused; shapes.forEach(shape => { if (animationPaused) { shape.style.animationPlayState = 'paused'; } else { shape.style.animationPlayState = 'running'; } }); const statusText = animationPaused ? '动画已暂停' : '动画已继续'; document.getElementById('status').textContent = statusText; document.getElementById('status').style.color = animationPaused ? '#ff69b4' : '#00ff88'; } // 页面加载时自动加载预设 window.onload = function() { setTimeout(loadGeometricPreset, 500); };