Files
Re-Commander/public/animator-simple.html

695 lines
22 KiB
HTML
Raw Normal View History

2026-05-12 00:30:45 +03:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Re-Commander — Animator</title>
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
<!-- Material Icons -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Golden Layout -->
<link rel="stylesheet" href="https://golden-layout.com/assets/css/goldenlayout-base.css">
<link rel="stylesheet" href="https://golden-layout.com/assets/css/goldenlayout-dark-theme.css">
<script src="https://cdn.jsdelivr.net/npm/golden-layout@2/dist/umd/index.js"></script>
<!-- Theatre.js (temporarily disabled) -->
<!-- <script src="https://unpkg.com/@theatre/core@0.7.2/dist/theatre-core.umd.js"></script>
<script src="https://unpkg.com/@theatre/studio@0.7.2/dist/theatre-studio.umd.js"></script> -->
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Roboto', sans-serif;
background: #121212;
color: #ffffff;
overflow: hidden;
height: 100vh;
display: flex;
flex-direction: column;
}
/* Material Design Top Bar */
.top-bar {
height: 64px;
background: #1e1e1e;
border-bottom: 1px solid #333;
display: flex;
align-items: center;
padding: 0 16px;
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
z-index: 1000;
flex-shrink: 0;
}
.logo-section {
display: flex;
align-items: center;
margin-right: 32px;
}
.logo {
width: 32px;
height: 32px;
background: linear-gradient(45deg, #2196F3, #1976D2);
border-radius: 8px;
margin-right: 12px;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
color: white;
font-size: 16px;
}
.app-title {
font-size: 20px;
font-weight: 500;
color: #ffffff;
}
/* Dropdown Menus */
.dropdown {
position: relative;
margin-right: 8px;
}
.dropdown-button {
background: transparent;
border: none;
color: #ffffff;
padding: 8px 16px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
border-radius: 4px;
transition: background 0.2s;
display: flex;
align-items: center;
gap: 4px;
}
.dropdown-button:hover {
background: rgba(255,255,255,0.1);
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
background: #2d2d2d;
border: 1px solid #444;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
min-width: 160px;
display: none;
z-index: 1001;
}
.dropdown-menu.show {
display: block;
}
.dropdown-item {
padding: 12px 16px;
cursor: pointer;
transition: background 0.2s;
font-size: 14px;
color: #ffffff;
}
.dropdown-item:hover {
background: rgba(255,255,255,0.1);
}
.dropdown-divider {
height: 1px;
background: #444;
margin: 4px 0;
}
/* Connection Status */
.connection-status {
display: flex;
align-items: center;
gap: 8px;
margin-left: auto;
margin-right: 16px;
padding: 6px 12px;
background: rgba(255,255,255,0.05);
border-radius: 16px;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #666;
animation: pulse 2s infinite;
}
.status-dot.connected {
background: #4CAF50;
}
.status-dot.disconnected {
background: #f44336;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.status-text {
font-size: 12px;
color: #ccc;
}
/* Action Buttons */
.action-buttons {
display: flex;
align-items: center;
gap: 8px;
margin-right: 16px;
}
.icon-button {
width: 40px;
height: 40px;
border-radius: 50%;
border: none;
background: rgba(255,255,255,0.1);
color: #ffffff;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}
.icon-button:hover {
background: rgba(255,255,255,0.2);
transform: scale(1.05);
}
/* Animation Name Section */
.animation-section {
display: flex;
align-items: center;
gap: 8px;
}
.animation-input {
background: rgba(255,255,255,0.1);
border: 1px solid #444;
border-radius: 4px;
padding: 8px 12px;
color: #ffffff;
font-size: 14px;
width: 200px;
transition: border-color 0.2s;
}
.animation-input:focus {
outline: none;
border-color: #2196F3;
}
.export-button {
background: #2196F3;
border: none;
color: white;
padding: 8px 16px;
border-radius: 4px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
display: flex;
align-items: center;
gap: 4px;
}
.export-button:hover {
background: #1976D2;
}
/* Golden Layout Container */
#layout-container {
flex: 1;
width: 100%;
background: #1a1a1a;
}
/* Golden Layout Customization */
.gl_container {
background: #1a1a1a !important;
}
.gl_tab {
background: #2d2d2d !important;
color: #ffffff !important;
border-bottom: 2px solid #444 !important;
padding: 8px 12px !important;
font-size: 12px !important;
}
.gl_tab.gl_active {
background: #2196F3 !important;
color: #ffffff !important;
border-bottom: 2px solid #2196F3 !important;
}
.gl_tab:hover {
background: #333333 !important;
}
.gl_tabBar {
background: #2d2d2d !important;
border-bottom: 1px solid #444 !important;
}
.gl_header {
background: #2d2d2d !important;
border-bottom: 1px solid #444 !important;
padding: 6px !important;
}
.gl_splitter {
background: #444 !important;
}
</style>
</head>
<body>
<!-- Material Design Top Bar -->
<header class="top-bar">
<!-- Logo/Title Section -->
<div class="logo-section">
<div class="logo">R</div>
<div class="app-title">Re-Commander Animator</div>
</div>
<!-- File Menu -->
<div class="dropdown">
<button class="dropdown-button" onclick="toggleDropdown('file-menu')">
File <span class="material-icons" style="font-size: 16px;">arrow_drop_down</span>
</button>
<div class="dropdown-menu" id="file-menu">
<div class="dropdown-item">New Animation</div>
<div class="dropdown-item">Open Animation</div>
<div class="dropdown-item">Save Animation</div>
<div class="dropdown-item">Save As...</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item">Import</div>
<div class="dropdown-item">Export</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item">Exit</div>
</div>
</div>
<!-- Edit Menu -->
<div class="dropdown">
<button class="dropdown-button" onclick="toggleDropdown('edit-menu')">
Edit <span class="material-icons" style="font-size: 16px;">arrow_drop_down</span>
</button>
<div class="dropdown-menu" id="edit-menu">
<div class="dropdown-item">Undo</div>
<div class="dropdown-item">Redo</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item">Cut</div>
<div class="dropdown-item">Copy</div>
<div class="dropdown-item">Paste</div>
<div class="dropdown-item">Delete</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item">Select All</div>
<div class="dropdown-item">Preferences</div>
</div>
</div>
<!-- Connection Status -->
<div class="connection-status">
<div class="status-dot disconnected" id="status-dot"></div>
<span class="status-text" id="status-text">Disconnected</span>
</div>
<!-- Action Buttons -->
<div class="action-buttons">
<button class="icon-button" title="Upload">
<span class="material-icons">upload</span>
</button>
<button class="icon-button" title="Settings">
<span class="material-icons">settings</span>
</button>
</div>
<!-- Animation Name & Export -->
<div class="animation-section">
<input type="text" class="animation-input" placeholder="Animation name..." id="animation-name">
<button class="export-button">
<span class="material-icons" style="font-size: 16px;">download</span>
Export
</button>
</div>
</header>
<!-- Golden Layout Container -->
<div id="layout-container"></div>
<script src="https://cdn.jsdelivr.net/npm/golden-layout@2/dist/umd/index.js"></script>
<script>
// Dropdown functionality
function toggleDropdown(menuId) {
const menu = document.getElementById(menuId);
const allMenus = document.querySelectorAll('.dropdown-menu');
allMenus.forEach(m => {
if (m.id !== menuId) {
m.classList.remove('show');
}
});
menu.classList.toggle('show');
}
// Close dropdowns when clicking outside
document.addEventListener('click', (e) => {
if (!e.target.closest('.dropdown')) {
document.querySelectorAll('.dropdown-menu').forEach(menu => {
menu.classList.remove('show');
});
}
});
// Simulate connection status
let connected = false;
function updateConnectionStatus() {
const dot = document.getElementById('status-dot');
const text = document.getElementById('status-text');
connected = !connected;
if (connected) {
dot.className = 'status-dot connected';
text.textContent = 'Connected to Jibo';
} else {
dot.className = 'status-dot disconnected';
text.textContent = 'Disconnected';
}
}
// Update connection status every 3 seconds for demo
setInterval(updateConnectionStatus, 3000);
// Basic Timeline Initialization (without Theatre.js for now)
function initializeTheatreTimeline(containerElement) {
console.log('Initializing basic timeline...');
// Add playback controls
const playBtn = containerElement.querySelector('#play-btn');
const pauseBtn = containerElement.querySelector('#pause-btn');
const stopBtn = containerElement.querySelector('#stop-btn');
const timeDisplay = containerElement.querySelector('#time-display');
const timelineContainer = containerElement.querySelector('#theatre-timeline');
let isPlaying = false;
let startTime = 0;
let currentTime = 0;
let animationFrame = null;
// Create basic timeline visualization
if (timelineContainer) {
timelineContainer.innerHTML = `
<div style="padding: 20px; height: 100%; background: #2d2d2d; border-radius: 4px; position: relative; overflow: hidden;">
<div style="position: absolute; top: 20px; left: 20px; right: 20px; height: 2px; background: #444;">
<div id="timeline-progress" style="width: 0%; height: 100%; background: #2196F3; transition: width 0.1s;"></div>
</div>
<div style="position: absolute; top: 40px; left: 20px; right: 20px; display: flex; justify-content: space-between; font-size: 10px; color: #666;">
<span>0s</span>
<span>1s</span>
<span>2s</span>
<span>3s</span>
<span>4s</span>
<span>5s</span>
</div>
<div style="position: absolute; top: 80px; left: 20px; right: 20px; bottom: 20px;">
<div style="font-size: 12px; color: #ccc; margin-bottom: 10px;">Timeline Ready</div>
<div style="background: #1e1e1e; padding: 10px; border-radius: 4px; font-size: 11px; color: #666;">
Basic timeline component - Theatre.js integration pending
</div>
</div>
</div>
`;
}
function updateTime() {
if (isPlaying) {
currentTime = (Date.now() - startTime) / 1000;
timeDisplay.textContent = currentTime.toFixed(2) + 's';
// Update progress bar
const progress = Math.min((currentTime / 5) * 100, 100); // 5 second timeline
const progressBar = containerElement.querySelector('#timeline-progress');
if (progressBar) {
progressBar.style.width = progress + '%';
}
animationFrame = requestAnimationFrame(updateTime);
}
}
if (playBtn) {
playBtn.addEventListener('click', () => {
if (!isPlaying) {
isPlaying = true;
startTime = Date.now() - (currentTime * 1000);
updateTime();
playBtn.style.background = '#666';
pauseBtn.style.background = '#FF9800';
}
});
}
if (pauseBtn) {
pauseBtn.addEventListener('click', () => {
isPlaying = false;
if (animationFrame) {
cancelAnimationFrame(animationFrame);
}
playBtn.style.background = '#4CAF50';
pauseBtn.style.background = '#666';
});
}
if (stopBtn) {
stopBtn.addEventListener('click', () => {
isPlaying = false;
currentTime = 0;
startTime = Date.now();
timeDisplay.textContent = '0.00s';
// Reset progress bar
const progressBar = containerElement.querySelector('#timeline-progress');
if (progressBar) {
progressBar.style.width = '0%';
}
if (animationFrame) {
cancelAnimationFrame(animationFrame);
}
playBtn.style.background = '#4CAF50';
pauseBtn.style.background = '#FF9800';
});
}
console.log('Basic timeline initialized successfully');
}
// Initialize Golden Layout
document.addEventListener('DOMContentLoaded', () => {
// Wait for GoldenLayout to be available
function waitForGoldenLayout() {
if (typeof GoldenLayout === 'undefined') {
console.log('GoldenLayout not yet available, retrying...');
setTimeout(waitForGoldenLayout, 100);
return;
}
console.log('GoldenLayout found, initializing...');
const config = {
root: {
type: 'row',
children: [
{
type: 'component',
componentType: 'timeline',
componentState: { title: 'Timeline' },
title: 'Timeline',
width: 30
},
{
type: 'column',
children: [
{
type: 'component',
componentType: 'canvas',
componentState: { title: 'Canvas' },
title: 'Canvas',
height: 60
},
{
type: 'component',
componentType: 'properties',
componentState: { title: 'Properties' },
title: 'Properties',
height: 40
}
],
width: 40
},
{
type: 'column',
children: [
{
type: 'component',
componentType: 'library',
componentState: { title: 'Animation Library' },
title: 'Library',
height: 50
},
{
type: 'component',
componentType: 'preview',
componentState: { title: 'Preview' },
title: 'Preview',
height: 50
}
],
width: 30
}
]
}
};
const componentRegistry = new GoldenLayout.ComponentRegistry();
componentRegistry.registerComponent('timeline', (container, state) => {
container.element.innerHTML = `
<div style="padding: 20px; color: white; height: 100%; overflow-y: auto;">
<h3>${state.title}</h3>
<div id="theatre-timeline" style="margin-top: 16px; height: 300px; background: #2d2d2d; border-radius: 4px; position: relative;"></div>
<div id="theatre-controls" style="margin-top: 16px; display: flex; gap: 8px; align-items: center;">
<button id="play-btn" style="background: #4CAF50; border: none; color: white; padding: 8px 16px; border-radius: 4px; cursor: pointer;">
<span class="material-icons" style="font-size: 16px; vertical-align: middle;">play_arrow</span> Play
</button>
<button id="pause-btn" style="background: #FF9800; border: none; color: white; padding: 8px 16px; border-radius: 4px; cursor: pointer;">
<span class="material-icons" style="font-size: 16px; vertical-align: middle;">pause</span> Pause
</button>
<button id="stop-btn" style="background: #f44336; border: none; color: white; padding: 8px 16px; border-radius: 4px; cursor: pointer;">
<span class="material-icons" style="font-size: 16px; vertical-align: middle;">stop</span> Stop
</button>
<span style="margin-left: 16px; font-size: 12px; color: #ccc;">Time: <span id="time-display">0.00s</span></span>
</div>
<div style="margin-top: 16px;">
<h4 style="margin-bottom: 8px; font-size: 14px; color: #ccc;">Animation Tracks</h4>
<div id="tracks-list" style="background: #2d2d2d; padding: 12px; border-radius: 4px;">
<div style="padding: 8px; margin-bottom: 4px; background: #1e1e1e; border-radius: 2px; font-size: 12px;">
📍 Position Track
</div>
<div style="padding: 8px; margin-bottom: 4px; background: #1e1e1e; border-radius: 2px; font-size: 12px;">
🎭 Animation Track
</div>
<div style="padding: 8px; margin-bottom: 4px; background: #1e1e1e; border-radius: 2px; font-size: 12px;">
🎵 Audio Track
</div>
</div>
</div>
</div>
`;
// Initialize Theatre.js timeline in this container
setTimeout(() => {
if (typeof Theatre !== 'undefined') {
initializeTheatreTimeline(container.element);
}
}, 100);
});
componentRegistry.registerComponent('canvas', (container, state) => {
container.element.innerHTML = `
<div style="padding: 20px; color: white; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;">
<h3>${state.title}</h3>
<div style="margin-top: 20px; width: 200px; height: 200px; background: #2d2d2d; border: 2px dashed #444; border-radius: 8px; display: flex; align-items: center; justify-content: center;">
<span style="color: #666;">Animation Preview Area</span>
</div>
</div>
`;
});
componentRegistry.registerComponent('properties', (container, state) => {
container.element.innerHTML = `
<div style="padding: 20px; color: white; height: 100%; overflow-y: auto;">
<h3>${state.title}</h3>
<div style="margin-top: 16px;">
<div style="margin-bottom: 16px;">
<label style="display: block; margin-bottom: 4px; font-size: 12px; color: #ccc;">Duration (ms)</label>
<input type="number" value="1000" style="width: 100%; padding: 8px; background: #2d2d2d; border: 1px solid #444; border-radius: 4px; color: white;">
</div>
<div style="margin-bottom: 16px;">
<label style="display: block; margin-bottom: 4px; font-size: 12px; color: #ccc;">Easing</label>
<select style="width: 100%; padding: 8px; background: #2d2d2d; border: 1px solid #444; border-radius: 4px; color: white;">
<option>Linear</option>
<option>Ease In</option>
<option>Ease Out</option>
<option>Ease In Out</option>
</select>
</div>
</div>
</div>
`;
});
componentRegistry.registerComponent('library', (container, state) => {
container.element.innerHTML = `
<div style="padding: 20px; color: white; height: 100%; overflow-y: auto;">
<h3>${state.title}</h3>
<div style="margin-top: 16px;">
<div style="background: #2d2d2d; padding: 12px; border-radius: 4px; margin-bottom: 8px; cursor: pointer;">Eye Blink</div>
<div style="background: #2d2d2d; padding: 12px; border-radius: 4px; margin-bottom: 8px; cursor: pointer;">Head Nod</div>
<div style="background: #2d2d2d; padding: 12px; border-radius: 4px; margin-bottom: 8px; cursor: pointer;">Wave</div>
<div style="background: #2d2d2d; padding: 12px; border-radius: 4px; margin-bottom: 8px; cursor: pointer;">Dance</div>
</div>
</div>
`;
});
componentRegistry.registerComponent('preview', (container, state) => {
container.element.innerHTML = `
<div style="padding: 20px; color: white; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;">
<h3>${state.title}</h3>
<div style="margin-top: 20px; text-align: center;">
<span class="material-icons" style="font-size: 48px; color: #666;">play_circle</span>
<div style="margin-top: 8px; color: #666;">Click to preview</div>
</div>
</div>
`;
});
const layout = new GoldenLayout(config, componentRegistry, document.querySelector('#layout-container'));
layout.init();
}
// Start the initialization process
waitForGoldenLayout();
});
</script>
</body>
</html>