Import a 3D Model and automatically assign and export animations
TypeScript
some cleanup with theming
Scott Petrovic38e18027dff6
diff --git a/src/index.html b/src/index.htmlindex 7d79a1f..cb78263 100644--- a/src/index.html+++ b/src/index.html@@ -37,8 +37,7 @@<!-- Theme Toggle --><div id="theme-toggle-container"><button id="theme-toggle">- <span class="theme-icon">π</span>- <span class="theme-text">Dark</span>+ <span class="theme-icon">π</span></button></div>@@ -274,7 +273,7 @@<div id="animations-listing"><!-- Filter textbox for animations -->- <input type="text" id="animation-filter" placeholder="Filter animations..." style="width: 100%; padding: 0.5rem; background-color: #1f405a; border: none; border-radius: 4px;">+ <input type="text" id="animation-filter" placeholder="Filter animations..."><div id="animations-listing-header">diff --git a/src/lib/ThemeManager.ts b/src/lib/ThemeManager.tsindex 47311ed..f7a1e40 100644--- a/src/lib/ThemeManager.ts+++ b/src/lib/ThemeManager.ts@@ -2,7 +2,6 @@ export class ThemeManager {private current_theme: 'light' | 'dark' = 'dark'private theme_toggle_button: HTMLButtonElement | null = nullprivate theme_icon: HTMLElement | null = null- private theme_text: HTMLElement | null = nullconstructor () {this.initialize()@@ -12,7 +11,6 @@ export class ThemeManager {// Get DOM elementsthis.theme_toggle_button = document.querySelector('#theme-toggle')this.theme_icon = this.theme_toggle_button?.querySelector('.theme-icon') ?? null- this.theme_text = this.theme_toggle_button?.querySelector('.theme-text') ?? null// Load saved theme preferencethis.load_theme_preference()@@ -42,7 +40,7 @@ export class ThemeManager {private apply_theme (): void {const html_element = document.documentElement-+if (this.current_theme === 'light') {html_element.setAttribute('data-theme', 'light')} else {@@ -53,13 +51,11 @@ export class ThemeManager {}private update_toggle_ui (): void {- if (this.theme_icon !== null && this.theme_text !== null) {+ if (this.theme_icon !== null) {if (this.current_theme === 'light') {- this.theme_icon.textContent = 'βοΈ'- this.theme_text.textContent = 'Light'+ this.theme_icon.textContent = 'π'} else {- this.theme_icon.textContent = 'π'- this.theme_text.textContent = 'Dark'+ this.theme_icon.textContent = 'π'}}}diff --git a/src/styles.css b/src/styles.cssindex 7cbf0a0..ede03b5 100644--- a/src/styles.css+++ b/src/styles.css@@ -4,25 +4,29 @@:root {/* Dark theme (default) */--text-primary: white;- --text-secondary: #c4c4c4;+ --text-alternate: #dae2e6;- --bg-primary: #314F64;- --bg-tertiary: #171d2d;- --bg-alternate: #0f2f3d;- --bg-form: #1f405a;- --button-primary-start: rgb(175, 58, 190);+ --bg-primary: #2b4353;+ --bg-alternate: #426074;+ --bg-tertiary: #7a97aa;++ --button-primary-bg: rgb(175, 58, 190);+ --button-alternate-bg: rgba(175, 58, 190, 0.521);+ --button-shadow-color: rgba(64, 29, 68, 0.705);}/* Light theme */[data-theme="light"] {--text-primary: #2c3e50;- --text-secondary: #34495e;+ --text-alternate: #96a5ac;--bg-primary: #ecf0f1;- --bg-tertiary: #f8f9fa;- --bg-alternate: #e8eef2;- --bg-form: #ffffff;- --button-primary-start: #3498db;+ --bg-alternate: #cdd7dd;+ --bg-tertiary: #8b9bac;++ --button-primary-bg: #73b6e2c7;+ --button-alternate-bg: rgb(176, 216, 240);+ --button-shadow-color: #3d6986;}/* this was just a star (*) selector, but dark reader extension cannot parse that and crashes@@ -47,10 +51,17 @@ h1, h2, h3, h4, h5, h6, input, button, select {row-gap: 1rem;}+#animation-filter {+ width: 100%;+ padding: 0.5rem;+ background-color: var(--bg-tertiary);+ border: none;+ border-radius: 4px;+}hr {- border:1px solid var(--text-secondary);+ border:1px solid var(--bg-alternate);width: 100%;margin: 1rem 0rem;}@@ -58,7 +69,7 @@ hr {li{display: list-item;line-height: 135%;- color: var(--text-secondary);+ color: var(--text-primary);font-size: 13px;}@@ -85,25 +96,24 @@ input[type="number"] {padding: 0.5rem;border: 1px solid #878787;border-radius: 3px;- background: var(--bg-form);+ background: var(--bg-primary);width: 40px;}input[type="text"] {- background-color: var(--bg-form);- border: 1px solid var(--text-secondary);+ background-color: var(--bg-primary);+ border: 1px solid var(--text-primary);color: var(--text-primary);}/* used for animation play options */button.secondary-button {-background: var(--bg-alternate);-background: linear-gradient(0deg, var(--bg-alternate) 0%, var(--bg-tertiary) 100%);-+ background: linear-gradient(0deg, var(--bg-alternate) 0%, var(--bg-tertiary) 100%);+ box-shadow: 2px 2px 3px var(--button-shadow-color);border-radius: 3px;- border: 0;+ border: 1px solid grey;cursor: pointer;- transition: all 0.1s ease-in-out;+ transition: all 0.1s ease;}button.secondary-button:hover {background: var(--bg-primary);@@ -120,22 +130,20 @@ button.secondary-button.play}button, .button {-- background: #8e2a9b;- background: linear-gradient(180deg, var(--button-primary-start) 0%, var(--bg-tertiary) 100%);- box-shadow: 3px 3px 2px var(--bg-tertiary);+ background: var(--button-primary-bg);+ background: linear-gradient(180deg, var(--button-primary-bg) 0%, var(--button-alternate-bg) 100%);+ box-shadow: 3px 3px 2px var(--button-shadow-color);padding: 0.75rem 1.0rem;margin-right: 0.5rem;- border: 1px solid var(--text-secondary);+ border: 1px solid var(--button-shadow-color);border-radius: 0.25rem;cursor: pointer;text-align: center; /* useful for custom file upload label */- transition: all 0.05s ease-in-out;+ transition: all 0.1s ease;}button:hover, .button:hover {- background: #8e2a9b;- background: linear-gradient(180deg, rgba(142, 42, 155, 1) 0%, rgba(44, 31, 87, 1) 90%);-+ /* background: var(--button-primary-bg); */+ transform: scale(1.05);}button:active, .button:active {@@ -144,7 +152,7 @@ button:active, .button:active {}button:disabled {- background: var(--bg-tertiary);+ background: var(--button-alternate-bg);opacity: 0.5;cursor: not-allowed;border: none;@@ -168,7 +176,7 @@ button:disabled {height: 25px;padding: 0.4rem;border-radius: 4px;- border: 1px solid var(--text-secondary);+ border: 1px solid var(--text-primary);cursor: pointer;}@@ -188,14 +196,14 @@ canvas {select {padding: 0.5rem;- background: var(--bg-form);- border: 1px solid var(--text-secondary);+ background: var(--bg-alternate);+ border: 1px solid var(--text-alternate);border-radius: 4px;color: var(--text-primary);}option {- background: var(--bg-form);+ background: var(--bg-primary);color: var(--text-primary);border: none;border-radius: 0;@@ -203,8 +211,8 @@ option {#current-step-index {font-size: 15px;- background: white;- background: linear-gradient(150deg, var(--bg-form) 3%, var(--bg-alternate) 100%);+ background: var(--bg-alternate);+ background: linear-gradient(150deg, var(--bg-primary) 3%, var(--bg-alternate) 100%);padding: 0.7rem;border-radius: 39px;color: var(--text-primary);@@ -228,15 +236,15 @@ option {width: 300px;right: 20px;border-radius: 3px;- border: 1px solid var(--text-secondary);+ border: 1px solid var(--text-primary);max-height: calc(100% - 50px);box-shadow: 3px 3px 9px var(--bg-tertiary);}#info-messaging {padding: 0.5rem;font-size: 13px;- color: var(--text-secondary);- border: 1px solid var(--text-secondary);+ color: var(--text-primary);+ border: 1px solid var(--text-primary);}#load-model-tools, #load-skeleton-tools, #transform-controls, #skeleton-step-actions {@@ -250,12 +258,12 @@ option {height: fit-content;background: var(--bg-tertiary);- background: radial-gradient(circle, var(--bg-alternate) 0%, var(--bg-tertiary) 100%);+ background: radial-gradient(circle, var(--bg-alternate) 0%, var(--bg-primary) 100%);- box-shadow: 1px 1px 8px 0px var(--bg-tertiary);+ box-shadow: 1px 1px 8px 0px var(--bg-primary);top: 0;right: 0;- border: 1px dotted var(--text-secondary);+ border: 1px dotted var(--text-primary);padding: 1rem;height: 100%;overflow-y: auto;@@ -275,11 +283,6 @@ option {align-items: center;}--/* width */-/* ::-webkit-scrollbar {- width: 14px;- } *//* Track */::-webkit-scrollbar-track {@@ -306,7 +309,7 @@ option {overflow: auto;flex-direction: column;margin-bottom: 1rem;- border: 1px solid var(--text-secondary);+ border: 1px solid var(--text-primary);}#animations-items div {@@ -353,9 +356,6 @@ input[type="file"] {}---/* drop-down button *//* Dropdown Button *//* The container <div> - needed to position the dropdown content */@@ -383,7 +383,7 @@ input[type="file"] {}/* Change color of dropdown links on hover */- .dropdown-content a:hover {background-color: #ddd;}+ .dropdown-content a:hover {background-color: var(--text-primary)}/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */.show {display:block;}@@ -399,7 +399,6 @@ input[type="file"] {.tooltip {position: relative;display: inline-block;-}@@ -413,7 +412,7 @@ input[type="file"] {text-align: center;padding: 5px;border-radius: 4px;- border: 1px solid var(--text-secondary);+ border: 1px solid var(--text-primary);/* Position the tooltip */position: absolute;@@ -481,35 +480,29 @@ input[type="file"] {/* Theme toggle button styles */#theme-toggle-container {position: fixed;- top: 20px;- left: 20px;+ bottom: 20px;+ right: 200px;z-index: 1000;}#theme-toggle {- background: var(--bg-tertiary);- border: 1px solid var(--text-secondary);- border-radius: 20px;- padding: 0.5rem 1rem;+ background: var(--bg-primary);+ border: 1px solid var(--text-primary);+ border-radius: 70px;+ padding: 0.5rem;cursor: pointer;display: flex;align-items: center;- gap: 0.5rem;- color: var(--text-primary);- font-size: 14px;- transition: all 0.3s ease;- box-shadow: 0 2px 4px var(--bg-tertiary);+ transition: all 0.2s ease;}#theme-toggle:hover {background: var(--bg-alternate);- transform: translateY(-1px);- box-shadow: 0 4px 8px var(--bg-tertiary);}#theme-toggle .theme-icon {- font-size: 18px;- transition: transform 0.3s ease;+ font-size: 30px;+ transition: transform 0.2s ease;}#theme-toggle:hover .theme-icon {