如何通过GuiViewer3D初始化配置参数设置背景色避免闪烁?
Forge Web Viewer 初始化时直接配置背景色方案
可以直接在初始化GuiViewer3D时通过配置参数设置背景色,彻底避免后续调用setBackgroundColor触发TOOLBAR_CREATED_EVENT导致的闪烁问题。
单一背景色配置示例
在构造GuiViewer3D实例时,通过backgroundColor参数指定颜色:
const viewer = new Autodesk.Viewing.GuiViewer3D( document.getElementById('viewer-container'), { backgroundColor: new THREE.Color(0xf5f5f5), // 替换为目标颜色值 // 其他初始化配置参数 } );
渐变背景色配置示例
如果需要上下分层的渐变背景,可使用backgroundGradient参数:
const viewer = new Autodesk.Viewing.GuiViewer3D( document.getElementById('viewer-container'), { backgroundGradient: { top: new THREE.Color(0xffffff), bottom: new THREE.Color(0xe8e8e8) }, // 其他初始化配置参数 } );
内容的提问来源于stack exchange,提问作者LucVallot
相关产品推荐
相关产品推荐

