X3DOM 更新属性

X3DOM update attribute

本文关键字:属性 更新 X3DOM      更新时间:2023-09-26

>我尝试更新形状的颜色,但它没有改变(尽管 F12 说,属性已更新)

 <transform scale="10 10 10" onmousedown="$('#matT').attr('diffuseColor', '0 0 1');">               
      <shape def="boxshape11">
           <appearance def="boxApp11">
                 <material id="matT" diffuseColor="1 1 0" specularColor=".5 .5 .5" />
            </appearance>
            <box def="box1" />
       </shape>
  </transform> 

使用 prop 代替 off attr 解决了问题

 <transform scale="10 10 10" onmousedown="$('#matT').prop('diffuseColor', '0 0 1');">               
      <shape def="boxshape11">
           <appearance def="boxApp11">
                 <material id="matT" diffuseColor="1 1 0" specularColor=".5 .5 .5" />
            </appearance>
            <box def="box1" />
       </shape>
  </transform>