Skip to content

Instantly share code, notes, and snippets.

@arturitu
Last active June 16, 2019 09:27
Show Gist options
  • Save arturitu/c69dc452d70298d44cae39c5a145ace6 to your computer and use it in GitHub Desktop.
Save arturitu/c69dc452d70298d44cae39c5a145ace6 to your computer and use it in GitHub Desktop.
Embed a 3D model with model-viewer with AR support
<!-- Import the component -->
<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>
<!-- Use it like any other HTML element -->
<model-viewer src="assets/model.glb" ios-src="assets/model.usdz" preload camera-controls
background-color="#cccccc" auto-rotate shadow-intensity=".8" poster="img/poster.png"
alt="A 3D model of a futuristic chest">
</model-viewer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment