原语的 setAttribute 语法

syntax to setAttribute for primitive

正确的语法是什么?

popscreen.setAttribute('geometry','primitive','plane');

popscreen.setAttribute('geometry','primitive:plane');

我似乎无法正常工作,所以也许是其他原因?未应用原语。

另外,当我试过这个时:

popscreen.setAttribute('geometry', { 'primitive': 'plane', width: '5', height: '5'});

...设置了高度和宽度,但未设置图元。

我在处理文本时遇到了类似的问题,但我却收到了这个错误: components:text:error TypeError: 无法读取 null属性 'layout'

对于此代码:

popscreen.setAttribute('text', 'color', 'white');

谢谢!

确保调用了这些方法,因为这些方法工作正常(实时 fiddle here

两者都

setAttribute('geometry','primitive','plane');

对于单个属性更改,或者

setAttribute('geometry', { 'primitive': 'plane', 'width': '5', 'height': '5'});

用于更改多个属性