我试图使用角度(版本 4)组件中设置的值来指定 aframe 对象的位置:
<a-text value="Plane" position="{{billBoard.x}} {{billBoard.y}} {{billBoard.z}}" color="#806040" side="double"></a-text>
角度构造函数:
constructor() {
this.billBoard['x'] = 1;
this.billBoard['y'] = 3;
this.billBoard['z'] = 6;
}
但是,它忽略 Angular 组件中的值,仅默认为 (0,0,0)。我究竟做错了什么?
你不能进行字符串插值,你必须使用 Angular 的[attr.*]数据绑定(ng-attr-*对于 AngularJS)。
Example:
import ...
@Component({
selector: 'app-root',
template: `
<a-scene>
<a-box [attr.position]="'0 ' + pos.y +' 0'" color="red"></a-box>
<a-plane rotation="-90 0 0" width="75" height="75" color="blue"></a-plane>
<a-sky color="#f9f9f9"></a-sky>
</a-scene>
`
})
export class App {
// a-box position
private pos = new THREE.Vector3(0, 5, 0);
}
看看这个笨蛋:Angular A-Frame - 设置组件属性值 https://plnkr.co/edit/2p3GEEbRXozuDithTop7?p=preview
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)