model-viewer icon indicating copy to clipboard operation
model-viewer copied to clipboard

fix reverse animation play and improve code structure

Open mohammadbaghaei opened this issue 9 months ago • 2 comments

mohammadbaghaei avatar Apr 16 '25 20:04 mohammadbaghaei

Also, I’d appreciate it if you could take a look at the GitHub Pages deployment for modelviewer.dev. It seems that new changes aren’t being deployed properly due to a token or permission issue.

mohammadbaghaei avatar Apr 16 '25 21:04 mohammadbaghaei

Also, I’d appreciate it if you could take a look at the GitHub Pages deployment for modelviewer.dev. It seems that new changes aren’t being deployed properly due to a token or permission issue.

Thanks for your patience. We’re actively reviewing what’s changed since the previous handoff and will update you shortly.

samaneh-kazemi avatar Apr 17 '25 19:04 samaneh-kazemi

Hi, thanks for contributing to model-viewer. I noticed each of your commits address a different topic. I'd recommend to have separate PRs for each of those. Having separate PRs make it easier to review, test, and revert them individually.

samaneh-kazemi avatar Jun 30 '25 17:06 samaneh-kazemi

Hi, thanks for contributing to model-viewer. I noticed each of your commits address a different topic. I'd recommend to have separate PRs for each of those. Having separate PRs make it easier to review, test, and revert them individually.

Hi! Thanks for pointing that out — it's a great catch. I'll definitely keep it in mind for future contributions. That said, I feel the overall review and PR merging process could be a bit faster. It would really help with keeping things moving smoothly.

mohammadbaghaei avatar Jul 01 '25 09:07 mohammadbaghaei

Hello @mohammadbaghaei i had the same issue as #5026 so i've tried using your fork but i still have the same issue. When i play an animation backward, it seems the animation skips directly to the end (so the start of the forward animation).

This is how i play it forward and backward using a condition:

modelViewer.appendAnimation(animation.name, {repetitions: 1, timeScale: playForward ? 1 : -1})

davide-granello avatar Jul 04 '25 12:07 davide-granello

Hi @mohammadbaghaei, thanks for your thoughtful reply and for being open to feedback. I completely understand how a faster review and merging process can make a big difference for contributors, and I appreciate your patience.

This PR addresses both the reverse animation fix and some broader code structure improvements. To help with review and make merging easier, would you be able to split this into smaller PRs? For example, one PR could focus solely on fixing the reverse animation play issue, and another on the code refactoring. This way, each change can be reviewed and tested independently, which reduces risk and usually helps things move through the review process more quickly.

Also, when you’ve updated the PRs or have new ones ready for review, please feel free to ping me, @-mention me, or bump the thread so I know you’re ready for feedback. I’ll do my best to prioritize the review.

Thanks again for your contributions and for sharing your perspective!

samaneh-kazemi avatar Jul 10 '25 02:07 samaneh-kazemi

Hi @davide-granello, I tested this snippet with several examples, including the one from issue #5026, and everything seems to work fine — the animations reverse smoothly without any skips. Could you please share the specific code where you're seeing the issue? That would help me investigate it more accurately.

mohammadbaghaei avatar Jul 28 '25 03:07 mohammadbaghaei

Hey @mohammadbaghaei i actually solved it in the meantime, i made some tests and found that i needed to set the time to animation.duration when playing it backwards. So now my code looks like this:

modelViewer.value.appendAnimation(animation.name, {
    repetitions: 1,
    time: playForward ? 0 : animation.duration,
    timeScale: playForward ? 1 : -1
  })

Everything works fine. Thank you

davide-granello avatar Jul 28 '25 06:07 davide-granello

Split into multiple PRs as requested. Closing this one.

mohammadbaghaei avatar Nov 11 '25 20:11 mohammadbaghaei