Skip to content

Commit

Permalink
updated examples (google#3578)
Browse files Browse the repository at this point in the history
  • Loading branch information
elalish authored Jul 12, 2022
1 parent a09e2dd commit 84339ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions packages/modelviewer.dev/examples/augmentedreality/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,13 @@ <h4>This demonstrates several augmented reality modes, including
does not support animations yet). Also, this source can be either
a .usdz or a .reality file.
</p>
<p>
Additionally, <code>ar-scale="fixed"</code> is used to prevent the
user from scaling the object in AR, applying to all three AR
modes. The <code>xr-environment</code> attribute causes estimated
lighting to be used in the WebXR AR mode, rather than the lighting
from the 3D mode, but does not affect Quick Look or Scene Viewer.
</p>
</div>
<example-snippet stamp-to="ar" highlight-as="html">
<template>
Expand Down
9 changes: 7 additions & 2 deletions packages/modelviewer.dev/examples/scenegraph/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ <h2 class="demo-title">Create textures</h2>
</model-viewer>
<script type="module">
const modelViewerTexture = document.querySelector("model-viewer#duck");
const textureName = document.querySelector('#texture-name');
const imageName = document.querySelector('#image-name');

modelViewerTexture.addEventListener("load", () => {

Expand All @@ -345,6 +347,9 @@ <h2 class="demo-title">Create textures</h2>
if (event.target.value == "None") {
// Clears the texture.
material[channel].setTexture(null);
// Display the names values
textureName.innerText = "None";
imageName.innerText = "None";
} else if (event.target.value) {
// Creates a new texture.
const texture = await modelViewerTexture.createTexture(event.target.value);
Expand All @@ -353,8 +358,8 @@ <h2 class="demo-title">Create textures</h2>
// Applies the new texture to the specified channel.
material[channel].setTexture(texture);
// Display the names values
document.querySelector('#texture-name').innerText = texture.name;
document.querySelector('#image-name').innerText = texture.source.name;
textureName.innerText = texture.name;
imageName.innerText = texture.source.name;
}
}

Expand Down

0 comments on commit 84339ce

Please sign in to comment.