Import a 3D Model and automatically assign and export animations
TypeScript
Move animation player to bottom area
Scott Petrovic30fd79855ae0
diff --git a/src/animation-player.css b/src/animation-player.cssindex 6dc7651..15ddeb1 100644--- a/src/animation-player.css+++ b/src/animation-player.css@@ -1,94 +1,95 @@+/* Free-floating Animation Player at bottom of screen */#animation-player {- background-color: var(--bg-alternate);- border-radius: 8px;- padding: 1rem;- margin: 1rem 0;+ position: fixed;+ bottom: 20px;+ left: 50%;+ transform: translateX(-50%);+ display: flex;+ align-items: center;+ gap: 15px;+ background: var(--bg-primary);border: 1px solid var(--bg-tertiary);+ border-radius: 30px;+ padding: 12px 20px;+ backdrop-filter: blur(10px);+ z-index: 1000;+ min-width: 450px;+ visibility: hidden; /* Hidden by default until animation is loaded */+ transition: all 0.3s ease;}-#animation-player-header {- display: flex;- justify-content: space-between;- align-items: center;- margin-bottom: 0.75rem;+#animation-player.visible {+ visibility: visible;}#current-animation-name {- font-weight: bold;+ font-size: 14px;+ font-weight: 600;color: var(--text-primary);- flex: 1;+ white-space: nowrap;+ max-width: 150px;overflow: hidden;text-overflow: ellipsis;- white-space: nowrap;+ min-width: 120px;}-#animation-player-controls {- display: flex;- align-items: center;- gap: 0.5rem;-}--#play-pause-button {- padding: 0.5rem;- width: 40px;- height: 40px;+.animation-control-button {+ width: 42px;+ height: 42px;+ border-radius: 50%;+ border: none;+ background: var(--button-primary-bg);+ color: white;+ cursor: pointer;display: flex;align-items: center;justify-content: center;- border-radius: 50%;- margin: 0;+ transition: all 0.2s ease;}-#play-pause-button:disabled {- opacity: 0.5;- cursor: not-allowed;-}+.animation-control-button:hover:not(:disabled) {+ background: var(--button-alternate-bg);+ transform: scale(1.05);-#animation-timeline-container {- width: 100%;}-#animation-timeline {- width: 100%;+.animation-control-button .material-symbols-outlined {+ font-size: 22px;+ font-weight: 400;}#animation-scrubber {- width: 100%;- height: 6px;- border-radius: 3px;- background: var(--bg-primary);+ flex: 1;+ height: 8px;+ border-radius: 4px;+ background: var(--bg-tertiary);outline: none;- margin-bottom: 0.5rem;cursor: pointer;+ min-width: 180px;+ appearance: none;+ -webkit-appearance: none;+ margin: 0 8px;}-#animation-scrubber::-webkit-slider-thumb {- appearance: none;- width: 16px;- height: 16px;- border-radius: 50%;- background: var(--button-primary-bg);- cursor: pointer;- border: 2px solid var(--text-primary);+#animation-scrubber::-webkit-slider-track {+ height: 8px;+ border-radius: 4px;+ background: var(--bg-primary);}-#animation-scrubber::-moz-range-thumb {- width: 16px;- height: 16px;+#animation-scrubber::-webkit-slider-thumb {+ appearance: none;+ width: 20px;+ height: 20px;border-radius: 50%;background: var(--button-primary-bg);cursor: pointer;- border: 2px solid var(--text-primary);+ border: 3px solid white;+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);+ transition: all 0.2s ease;}-#timeline-labels {- display: flex;- justify-content: space-between;- font-size: 12px;- color: var(--text-alternate);+#animation-scrubber::-webkit-slider-thumb:hover {+ transform: scale(1.1);+ box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);}--#animation-scrubber:disabled {- opacity: 0.5;- cursor: not-allowed;-}\ No newline at end of filediff --git a/src/index.html b/src/index.htmlindex dbf3fa5..d9c783b 100644--- a/src/index.html+++ b/src/index.html@@ -277,27 +277,6 @@<!-- Filter textbox for animations --><input type="text" id="animation-filter" placeholder="Filter animations...">- <!-- Mini Animation Player -->- <div id="animation-player">- <div id="animation-player-header">- <span id="current-animation-name">No animation selected</span>- <div id="animation-player-controls">- <button id="play-pause-button" class="secondary-button" disabled>- <span class="material-symbols-outlined">play_arrow</span>- </button>- </div>- </div>- <div id="animation-timeline-container">- <div id="animation-timeline">- <input type="range" id="animation-scrubber" min="0" max="100" value="0" disabled>- <div id="timeline-labels">- <span id="current-time">0</span>- <span id="total-time">0</span>- </div>- </div>- </div>- </div>-<div id="animations-listing-header"><span>Animation name</span><div style="margin-right: 1rem;">Export</div>@@ -363,6 +342,18 @@</div> <!-- end tool-panel-->+ <!-- Free-floating Animation Player -->+ <div id="animation-player">+ <span id="current-animation-name">No animation selected</span>+ <button id="play-pause-button" class="animation-control-button" disabled>+ <span class="material-symbols-outlined">play_arrow</span>+ </button>+ <span>+ <span id="current-time">0f</span> /+ <span id="total-time">0f</span>+ </span>+ <input type="range" id="animation-scrubber" min="0" max="100" value="0" disabled>+ </div><!-- info panel for messages and information--><div id="info-panel">diff --git a/src/lib/AnimationPlayer.ts b/src/lib/AnimationPlayer.tsindex d37c4d3..827bb6e 100644--- a/src/lib/AnimationPlayer.ts+++ b/src/lib/AnimationPlayer.ts@@ -51,13 +51,18 @@ export class AnimationPlayer {const fps = 30const total_frames = Math.floor(animation_clip.duration * fps)+ // Show the animation player+ if (this.ui.dom_animation_player !== null) {+ this.ui.dom_animation_player.classList.add('visible')+ }+// Update UIif (this.ui.dom_current_animation_name !== null) {this.ui.dom_current_animation_name.textContent = animation_clip.name}if (this.ui.dom_total_time !== null) {- this.ui.dom_total_time.textContent = `${total_frames}f`+ this.ui.dom_total_time.textContent = `${total_frames}`}// Enable controls@@ -81,6 +86,11 @@ export class AnimationPlayer {this.current_animation_actions = []this.is_playing = false+ // Hide the animation player+ if (this.ui.dom_animation_player !== null) {+ this.ui.dom_animation_player.classList.remove('visible')+ }+// Update UIif (this.ui.dom_current_animation_name !== null) {this.ui.dom_current_animation_name.textContent = 'No animation selected'@@ -181,7 +191,7 @@ export class AnimationPlayer {// Update current frame displayif (this.ui.dom_current_time !== null) {- this.ui.dom_current_time.textContent = `${frame_number}f`+ this.ui.dom_current_time.textContent = `${frame_number}`}}@@ -204,7 +214,7 @@ export class AnimationPlayer {// Update current frame displayif (this.ui.dom_current_time !== null) {- this.ui.dom_current_time.textContent = `${current_frame}f`+ this.ui.dom_current_time.textContent = `${current_frame}`}// Check if animation has finished and loop it