如何使用角度参数指定aframe对象的位置? [英] How to specify position of an aframe object using angular parameters?
本文介绍了如何使用角度参数指定aframe对象的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用在angular(第4版)组件中设置的值来指定aframe对象的位置:
I am trying to specify the position of an aframe object using values set in the angular (version 4) component:
<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).我在做什么错了?
However, it ignores the values in the Angular component and just defaults to (0,0,0). What am I doing wrong?
推荐答案
您无法进行字符串插值,必须使用Angular的 [attr.*] 数据绑定( ng -attr-* (对于AngularJS).
You can't do string interpolation, you will have to use Angular's [attr.*] data binding (ng-attr-* for AngularJS).
示例:
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);
}
看到这个矮人: 角度A形-设置组件属性值
这篇关于如何使用角度参数指定aframe对象的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文