元件 HTML 表單

元件以一個或多個元件屬性的形式儲存一桶資料。元件使用此資料來修改實體。考慮一個引擎元件,我們可能會定義諸如馬力或汽缸等屬性。

HTML 屬性表示元件名稱,這些屬性的值表示元件資料。

單一屬性元件

如果元件是單屬性元件,意味著其資料由單個值組成,則在 HTML 中,元件值看起來像普通的 HTML 屬性:

<!-- `position` is the name of the position component. -->
<!-- `1 2 3` is the data of the position component. -->
<a-entity position="1 2 3"></a-entity>

多屬性元件

如果元件是多屬性元件,意味著資料由多個屬性和值組成,則在 HTML 中,元件值類似於內聯 CSS 樣式:

<!-- `light` is the name of the light component. -->
<!-- The `type` property of the light is set to `point`. -->
<!-- The `color` property of the light is set to `crimson`. -->
<a-entity light="type: point; color: crimson"></a-entity>