Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

allow scrubbing timeline to be more smooth not snapping to whole numbers

Scott Petrovic8d9b56e7189c
diff --git a/src/index.html b/src/index.html
index d32c4cd..88b7540 100644
--- a/src/index.html
+++ b/src/index.html
@@ -205,7 +205,7 @@
<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>
+ <input type="range" id="animation-scrubber" min="0" max="100" value="0" step="any" disabled>
<!-- checkbox option to show skeleton -->
diff --git a/src/lib/processes/animations-listing/AnimationPlayer.ts b/src/lib/processes/animations-listing/AnimationPlayer.ts
index c705e36..71e2e3a 100644
--- a/src/lib/processes/animations-listing/AnimationPlayer.ts
+++ b/src/lib/processes/animations-listing/AnimationPlayer.ts
@@ -182,7 +182,7 @@ export class AnimationPlayer {
}
const target = event.target as HTMLInputElement
- const frame_number = parseInt(target.value)
+ const frame_number = parseFloat(target.value)
// Convert frame to time (assuming 30 FPS)
const fps = 30
@@ -195,7 +195,7 @@ export class AnimationPlayer {
// Update current frame display
if (this.ui.dom_current_time !== null) {
- this.ui.dom_current_time.textContent = `${frame_number}`
+ this.ui.dom_current_time.textContent = `${Math.round(frame_number)}`
}
}
@@ -209,7 +209,7 @@ export class AnimationPlayer {
// Convert current time to frame number (assuming 30 FPS)
const fps = 30
- const current_frame = Math.floor(first_action.time * fps)
+ const current_frame = first_action.time * fps
// Update scrubber position based on frame number
if (this.ui.dom_animation_scrubber !== null) {
@@ -218,7 +218,7 @@ export class AnimationPlayer {
// Update current frame display
if (this.ui.dom_current_time !== null) {
- this.ui.dom_current_time.textContent = `${current_frame}`
+ this.ui.dom_current_time.textContent = `${Math.round(current_frame)}`
}
// Check if animation has finished and loop it
diff --git a/static/models-variation/human-sophia.glb b/static/models-variation/human-sophia.glb
index 289cf5d..2c7c73c 100644
Binary files a/static/models-variation/human-sophia.glb and b/static/models-variation/human-sophia.glb differ