2016-08-09 5 views
1

내가 GitHub의에서 다음 프로젝트에서 찾고있다 :Aframe의 개체에 템플릿 구성 요소를 사용하려면 어떻게해야합니까?

https://github.com/ngokevin/aframe-template-component

나는 템플릿을 사용하여 아주 새로운 오전.

<script id="clouds" type="text/x-jade-template"> 
     - for (var x = -5; x < 5; x++) { 
     - for (var z = -5; z < 5; z++) { 
      a-entity(geometry="primitive: box; depth: 8; height: 1; width: 6", material="opacity: 0.2", position="#{x * 20} 15 #{z * 20}") 
     - } 
     - } 
    </script> 

을하지만이 3D 객체를 사용할 때 작동하지 않습니다 :

이 다음 코드는 작동

<a-asset-item id="cloud-01-obj" src="cloud_1.obj"></a-asset-item> 

    <!-- Cloud template. --> 
    <script id="clouds" type="text/x-jade-template"> 
     - for (var x = -5; x < 5; x++) { 
     - for (var z = -5; z < 5; z++) { 
      a-entity(obj-model="obj: #cloud-01-obj", position="#{x * 2} 15 #{z *2}")     
     - } 
     - } 
    </script> 
    </a-assets> 

을 그리고 장면 블록에 있습니다 :

<a-entity template="src: #clouds"></a-entity> 

나는 장면에 다음 코드가 있기 때문에 3D 객체가로드된다는 것을 알고 있습니다. & 모든 다른 객체는 로드되었습니다.

<!-- cloud instances --> 
    <a-entity obj-model="obj: #cloud-01-obj" position="5.0 0.0 -1" rotation="0 30 0"></a-entity> 
    <a-entity obj-model="obj: #cloud-02-obj" position="5.0 1.0 5"></a-entity> 
    <a-entity obj-model="obj: #cloud-03-obj" position="7.0 2.0 5"></a-entity> 
    <a-entity obj-model="obj: #cloud-04-obj" position="8.0 3.0 5"></a-entity> 
    <a-entity obj-model="obj: #cloud-05-obj" position="13.0 2.0 6" ></a-entity> 
    <a-entity obj-model="obj: #cloud-06-obj" position="12.0 2.0 -1" </a-entity> 
    <a-entity obj-model="obj: #cloud-07-obj" position="-2.0 4 0" ></a-entity> 
    <a-entity obj-model="obj: #cloud-08-obj" position="-10.0 0.0 0" ></a-entity> 
    <a-entity obj-model="obj: #cloud-09-obj" position="-9.0 4.0 0" ></a-entity> 
+0

열고 DOM 관리자 봐 ''안에 있습니다. 렌더링 된 HTML은 어떤 모습입니까? – ngokevin

답변

1

문자열에 여분의 공간이있었습니다.

A-엔티티 (OBJ 모델 = "OBJ # 클라우드 09-OBJ"위치 = "# {X * 2} 15 # {Z * 2} ')

+1

Nunjucks 엔진을 지정하는 것이 좋습니다. 보간이 필요한 경우 API가 가장 좋습니다. '' – ngokevin