WebKit / explainers

Explainers from WebKit contributors
371 stars 28 forks source link

mutliple animation takes #67

Open chrisdubya-emed opened 3 years ago

chrisdubya-emed commented 3 years ago

It's common for models to have multiple animation takes bundled into or referenced within the model file (and they can be cycled through on the fly based on page events, etc). If there are multiple animation takes embedded in the model, would the following autoplay attribute loop through the first animation take that is found?

<model style="width: 400px; height: 300px" autoplay interactive>
    <source src="assets/example.usdz" type="model/vnd.usd+zip">
    <source src="assets/example.obj" type="model/obj">
</model>

I think there should be an attribute for specifying model clips. For reference, <model-viewer> implements this with several different attributes as documented here. A-Frame's animation-mixer-component also does something simialar declaratively.

donmccurdy commented 3 years ago

FWIW: Standard practice in glTF viewers is to play the first animation by default, and (ideally) provide some means of selecting others. More complex composition is possible but perhaps out of scope here.

chrisdubya-emed commented 3 years ago

I agree, I also think an autoplay boolean is a bit ambiguous in the context of a model. I think at a minimum you should be able to specify another animation other than the first.

spartanatreyu commented 3 years ago

Perhaps the desired animation could be specified in the element's attribute, then changed dynamically.

grorg commented 3 years ago

These are great suggestions.

We'll propose a JS API to select animation takes eventually, but an attribute might be a simple start. It does assume that the data format can name the animations.

And I agree that by default it should follow the glTF viewer behaviour of playing the first animation.

chrisdubya-emed commented 3 years ago

Agreed with starting with a simple attribute for specifying an animation name (given format support).

Then, I would think that the attribute would only work if the proposed autoplay attribute is present and true (and manually can work through a JS API with a .play() function). It may also be helpful to query for available animations through the JS API.