A-FRAMEについて

基本の構文

a-sceneの中に、要素(Entity)を入れる
Entityとは、<a-box>とか<a-sky>とかそういう、物体。
Entityに対して、a-assetで設定を紐づけすることができる。紐づけはidで行う。

a-assetは設定を入れておく箱みたいなもの。この中に、テクスチャ画像などをidをつけて入れておく。
entityはsrcにidを指定して、その設定を引っ張り出すことができる。src=”#id”という感じ。
こうすることでひとつのassetを複数のentityで使うことができる。

a-skyのテクスチャには360度カメラの画像を設定するイメージ。

上の記述は間違いかもしれない。
<a-box>などの書き方では表示されない場合がある。
<a-entity geometry=”primitive: box” material=”color: red”>
この書き方でないと表示されない時があるので、ちょっとわからない。

Entityコンポーネントシステム

a-entityに、設定を追加して要素を作成することができるシステム。
おそらく、aframe-particle-system-component.min.js これを入れることで使えるようになる。
https://aframe.io/docs/1.2.0/introduction/entity-component-system.html#syntax

<script
        src="https://unpkg.com/aframe-particle-system-component@1.0.9/dist/aframe-particle-system-component.min.js"></script>
<a-entity geometry="primitive: sphere; radius: 1.5"
light="type: point; color: white; intensity: 2"
material="color: white; shader: flat; src: glow.jpg"
position="0 0 -5"></a-entity>

こんな感じ。

コンポーネントを動的に作成する

https://aframe.io/docs/1.2.0/introduction/writing-a-component.html

マークなしのやつ

a-imageというタグをentityで使えるのだけど、ntfではa-imageが表示されなかった。3Dしか表示されない?

position

position=”x y z”

前の記事

npmについて

次の記事

リダイレクト (htaccess)