1

使用模型查看器(https://modelviewer.dev/examples/loading/index.html#glbModel)我想将我的加载颜色设置model-viewer为红色,但我没有在文档中找到与此相关的任何内容。

在此处输入图像描述

这是codepen链接:https ://codepen.io/luxonauta/pen/vYKYppq?editors=1010

<!-- Loads <model-viewer> for modern browsers-->
<script type="module" src="https://unpkg.com/@google/model-viewer@latest/dist/model-viewer.js"></script>
<!-- Loads <model-viewer> for old browsers like IE11-->
<script type="nomodule" src="https://unpkg.com/@google/model-viewer@latest/dist/model-viewer-legacy.js"></script>

<main>
  <section class="has-dflex-center">
    <div class="lx-container-80">
      <div class="lx-row">
        <div class="lx-card bs-lg">
          <model-viewer src="https://cdn.glitch.com/36cb8393-65c6-408d-a538-055ada20431b/Astronaut.glb?1542147958948" ios-src="https://cdn.glitch.com/36cb8393-65c6-408d-a538-055ada20431b/Astronaut.usdz?v=1569545377878" poster="https://cdn.glitch.com/36cb8393-65c6-408d-a538-055ada20431b%2Fposter-astronaut.png?v=1599079951717" alt="A 3D model of an astronaut!" shadow-intensity="1" camera-controls="true" auto-rotate="true" ar="true"></model-viewer>
          <p class="text"><i class="fas fa-hand-point-right"></i> This pen is a basic demo of the &lt;model-viewer&gt; web component. It makes displaying 3D and AR content on the web easy!</p>
        </div>
      </div>
    </div>
  </section>
</main>

Codepen 链接演示完全可用,只有红色未在此处实现:https ://codepen.io/luxonauta/pen/vYKYppq?editors=1010

请帮助我提前谢谢!

4

2 回答 2

3

您应该应用自定义 css 变量

model-viewer {
  --progress-bar-color: red;
}

于 2022-01-14T11:23:21.977 回答
1

您可以使用 CSS 轻松更改背景颜色。现在你的演示有

model-viewer {
  width: 100%;
  height: 25rem;
  background-color: #70bcd1;
}

只需将背景颜色更改为红色:

model-viewer {
  width: 100%;
  height: 25rem;
  background-color: #f00;
}

在此处输入图像描述

于 2022-01-12T23:13:41.247 回答