2017-05-02 9 views
1

Iは角度(バージョン4)コンポーネントに設定された値用いAFRAME物体の位置を特定しようとしている:しかし、それはの値を無視角度パラメータを使用してaframeオブジェクトの位置を指定する方法はありますか?

constructor() { 
    this.billBoard['x'] = 1; 
    this.billBoard['y'] = 3; 
    this.billBoard['z'] = 6; 
} 

<a-text value="Plane" position="{{billBoard.x}} {{billBoard.y}} {{billBoard.z}}" color="#806040" side="double"></a-text> 

角度コンストラクタ角度成分とデフォルトは(0,0,0)です。私は間違って何をしていますか?あなたは、文字列の補間を行うことはできません

答えて

1

、あなたは角度の[attrの。*]バインディングデータ(NG-attr-を* 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); 
} 

このplunkerを参照してください: Angular A-Frame - set component attribute values

関連する問題