0

我尝试更新形状的颜色,但它没有改变(尽管 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> 
4

1 回答 1

1

使用prop而不是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> 
于 2013-10-06T12:41:02.060 回答