google / google/model-viewer

Animations that end on intervals of 24-frames incorrectly return to their starting frame early

Open
#4,050 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8.2k
Forks
947
PR merge metrics
No merged PRs in 30d

Description

### Description

Something interesting that I have noted with animation today is that any animations that use 24fps and finish on an interval of 24 have an issue in Model Viewer. I have an animation that is 120 frames @ 24fps and an animation that is slightly longer 124 frames @ 24fps. The one that is 120 frames snaps back to the initial starting point of the animation before the animation completes when looping is turned off, but the animation that is 124 frames will stop at the end of the animation and then stay in place.

First, add the `cubeanum.glb` to the Model Editor and uncheck "Play" on the animation tab, dragging the slider all the way to the end(`5.0 seconds`), and the cube will snap back to its original location in the animation, but the animation frame is still at the end.

If you then upload the `cubeanim_fixed.glb` to Model Editor and do the same, you will see when the animation slider is dragged out to the end of the animation(`5.04 seconds`), the cube stays in the last frame of the animation and does not snap back. I have tested this with 3-second and 4-second animations as well, with the same breaking result where the animation snaps back to the original keyframe.

Broken: [cubeanim.glb](https://www.dropbox.com/s/o1wwac9jszjddm6/cubeanim.glb)
Working: [cubeanim_fixed.glb](https://www.dropbox.com/s/o1wwac9jszjddm6/cubeanim.glb?dl=0)

If you don't want to download these files, create an animation in Blender where the keyframes end at an interval of 24fps.

#### Live Demo

Repro via Model Editor. I have provided two different GLBs above.

### Version

- model-viewer: Whatever Model-Editor is currently using

### Browser Affected

- [X] Chrome, version: 108.0.5359.124
- [X] Edge
- [X] Firefox
- [ ] IE - Did not test
- [X] Safari

### OS

- [ ] Android
- [ ] iOS
- [ ] Linux
- [X] MacOS
- [X] Windows

### AR

- [ ] WebXR
- [ ] SceneViewer
- [ ] QuickLook

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.