在 Aframe 中刷新 Material 更新为 HTML
Flush Material Update to HTML in Aframe
var obj = document.querySelector("#sphere");
obj.components.material.data.roughness = 0.3;
obj.components.material.update(object);
obj.components.material.flushToDOM();
//I don't think object matters for this use,
// it is only useful for shaders I believe.
我正在尝试 "flushToDOM()",但这似乎根本没有更新实体 html material 它仍然停留在初始设置...
<a-sphere id="sphere" position="0 0.25 -4.5" radius="1.25" color="#712ef0" transparent="true" material="color:#712ef0;transparent:true;metalness:0.3;opacity:1" geometry="primitive:sphere;radius:1.25" rotation="0 0 0" scale="1 1 1">
您应该使用 setAttribute('material', 'roughness', 0.3)
。
但可能存在刷新 "sub-components" 着色器和几何图形的错误。将检查问题。
var obj = document.querySelector("#sphere");
obj.components.material.data.roughness = 0.3;
obj.components.material.update(object);
obj.components.material.flushToDOM();
//I don't think object matters for this use,
// it is only useful for shaders I believe.
我正在尝试 "flushToDOM()",但这似乎根本没有更新实体 html material 它仍然停留在初始设置...
<a-sphere id="sphere" position="0 0.25 -4.5" radius="1.25" color="#712ef0" transparent="true" material="color:#712ef0;transparent:true;metalness:0.3;opacity:1" geometry="primitive:sphere;radius:1.25" rotation="0 0 0" scale="1 1 1">
您应该使用 setAttribute('material', 'roughness', 0.3)
。
但可能存在刷新 "sub-components" 着色器和几何图形的错误。将检查问题。