Loads a glTF model from the URL given as the src
attribute and displays it.
By default the viewer will take the size of the surrounding container and does not allow the user to move the camera or zoom.
You can use the width
and height
attributes to specify the size of the viewer.
The viewer allows users to orbit around (drag) and zoom (scroll or pinch) on the object
as well as move it around (right click) when the interactive
property is present.
This behaviour can also be set dynamically by calling document.querySelector('gltf-viewer').interactive = true // or false
If a model contains animations, they will automatically play and loop.
You can stop and start animations by calling the stop
and stop
methods: