amp-3d-gltf component displays 3D models that are in glTF format. The doc describing this element can be found here
Note: A WebGL capable browser is required to display these models.
amp-3d-gltf component in the header.
<script async custom-element="amp-3d-gltf" src="https://cdn.ampproject.org/v0/amp-3d-gltf-0.1.js"></script>
Embed 3d model via the
<amp-3d-gltf layout="fixed" width="320" height="240" src="/static/samples/glTF/DamagedHelmet.glb"></amp-3d-gltf>
You can customize the 3D model using these attributes:
src- A required attribute that specifies the URL to the glTF file.
alpha- A Boolean attribute that specifies whether free space on canvas is transparent. By default, free space is filled with black. Default value is
antialiasing- A Boolean attribute that specifies whether to turn on antialiasing. Default value is
maxPixelRatio- A numeric value that specifies the upper limit for the pixelRatio render option. The default is
autoRotate- A Boolean attribute that specifies whether to automatically rotate the camera around the model's center. Default value is
enableZoom- A Boolean attribute that specifies whether to turn on zoom. Default value is
<amp-3d-gltf layout="fixed" width="320" height="240" alpha="true" antialiasing="true" autoRotate="true" enableZoom="false" src="/static/samples/glTF/DamagedHelmet.glb"></amp-3d-gltf>
If the explanations on this page don't cover all of your questions feel free to reach out to other AMP users to discuss your exact use case.Go to Stack OverflowAn unexplained feature?
The AMP project strongly encourages your participation and contributions! We hope you'll become an ongoing participant in our open source community but we also welcome one-off contributions for the issues you're particularly passionate about.Edit sample on GitHub
Written by @mixtur