Position and layout child entities in 3D space for A-Frame
npm install aframe-layout-componentLayout component for A-Frame.
Automatically positions child entities in 3D space, with several layouts to
choose from. Define the layout on the parent entity:
``html`
And then the positions will automatically be calculated and set:
`html`
As entities are added or removed, the layout component will trigger a reflow on
the positions.
We move then entire group around while maintaining the layout:
`html`
| Property | Description | Default Value |
|----------------|-----------------------------------------------------------------------------------------------------|---------------|
| type | Type of layout. Can be one of box, circle, cube, dodecahedron, line, pyramid. | line |box
| columns | Number of columns (for type ). | 1 |box
| margin | Margin in meters (for type , line). | 1 |box
| marginColumn | Margin in meters just for the columns (for type ). Defaults to margin value. | 1 |box
| marginRow | Margin in meters just for the rows (for type ). Defaults to margin value. | 1 |xy
| orderAttribute | Attribute name used to explicitly order the children versus relying on inherent DOM order. | '' |
| plane | Which plane direction for 2D layout. Can be , yz, or xz (for type box, circle, line) | xy |circle
| radius | Radius in meters (for type , cube, dodecahedron, pyramid. | 1 |circle
| reverse | Whether to reverse direction of layout. | false |
| angle | For type , set this to position items angle degrees apart | false |box
| align | Alignment of the center of layout (for type , line). Can be one of start, center, end. | start |
#### Browser Installation
Install and use by directly including the browser files:
`html
#### NPM Installation
Install via NPM:
`bash
npm install aframe-layout-component
`Then register and use.
`js
require('aframe');
require('aframe-layout-component');
``