Using model-viewer 3d custom element

WebGL 3d custom element in Webflow

FeedbackPreviewMore

Demo

☝view source!

Avocado model is public domain, via KhronosGroup/glTF-Sample-Models

---

For more info about the available attributes, see https://github.com/GoogleWebComponents/model-viewer#attributes

Example embed code:

<model-viewer
  alt="Avocado!"
  src="https://assets.website-files.com/5c013e2442f37ff004567ee6/5c014361f3b050fee37b480c_Avocado.glb.txt"
  style="width: 100%; height: 800px;"
  poster="https://assets.website-files.com/5c013e2442f37ff004567ee6/5c02ae2174a7d618520578bb_wf-avocado-loading.jpg"
  background-color="#f6ffe3"
  preload
  reveal-when-loaded
  auto-rotate
  camera-controls
></model-viewer>

<!--
  You only need the script tags once in the page for all model-viewer elements:
-->

<!-- Optional, for Safari support -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=IntersectionObserver"></script>

<!-- The model-viewer custom element -->
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.js"></script>
<script nomodule src="https://unpkg.com/@google/model-viewer/dist/model-viewer-legacy.js"></script>

---

Requires a workaround to upload glb file to your assets: add ".txt" to the end of the filename.

Then you can then get the link by clicking on the asset's ⚙️ and then the flie's ↗️ like this: