c-frame / aframe-extras

Add-ons and helpers for A-Frame VR.
https://c-frame.github.io/aframe-extras/examples/
MIT License
972 stars 305 forks source link

Fix animation startAt; add animation controls example #418

Closed diarmidmackenzie closed 1 year ago

diarmidmackenzie commented 1 year ago

Fix for #380

diarmidmackenzie commented 1 year ago

Thanks for the feedback. Sorry, I wrote the example code in a hurry, as I was mostly focussed on what the actual component did. Should have tidied it up a lot more before submitting a PR.

Just doing some testing now, I spotted a couple of things I hadn't noticed before, which I want to investigate before merging this PR...

  1. Duration doesn't work as I expected - it seems to slow the animation down (like timeScale, but in the reverse sense)

  2. ClampWhenFinished seems to act as if it is always "true".

diarmidmackenzie commented 1 year ago

ClampWhenFInished was a bug in my code - for a checkbox, don't read "value" property, read "checked" instead. Also updated on both click & change.

diarmidmackenzie commented 1 year ago

OK, I'd misunderstood the functon provided by 'duration'.

It is supposed to specify the duration of a singe loop of the animation. That's always been the case, evidence here, for example.

So why does timeScale also exist? Motivation seems to have been to provide a way to pause an animation.

I don't much like the interface. Seems unnecessary to have two different properties to do pretty much exactly the same thing. But we should maintain both properties for backwards compatibility reasons.

So for now, just documenting more clearly what 'duration' actually does.