2017-05-02 2 views
1

Ich versuche, die Position eines aframe Objekt zu spezifizieren Werte in der Winkel (Version 4) Komponente:Wie wird die Position eines Bildobjekts mit Winkelparametern angegeben?

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

Winkelbauer:

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

jedoch ignoriert die Werte in der Winkelkomponente und ist standardmäßig auf (0,0,0) voreingestellt. Was mache ich falsch?

Antwort

1

Sie können keine String-Interpolation tun, werden Sie eckiges verwenden müssen [attr. *] Datenbindung (ng-attr- * für AngularJS).

Beispiel:

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); 
} 

dieses Plunker Siehe: Angular A-Frame - set component attribute values

Verwandte Themen