Colour, size and rotation
Change how a shape looks: its colour, its size and which way it faces.
Your scene is drawn in 3D by your own browser, inside this tab. No headset needed.
Colour
color sets a shape's colour. It takes a colour name, such as red, or a code, such as #ff0000.
Note the spelling: like CSS, A-Frame uses the American color.
<a-scene>
<a-box position="-1 1 -3" color="red"></a-box>
<a-box position="1 1 -3" color="#3366ff"></a-box>
</a-scene>Your turn: a red box
One tag can carry several attributes.
Practice task
Write a scene with a red box at position 0 1 -3.
Your answer is run and checked in the lesson. Create a free account to try it.
Size
A box has a width, a height and a depth, each in metres. Left out, each is 1.
This makes it easy to turn a cube into a wall, a table top or a step.
<a-scene>
<a-box position="0 0.75 -4" width="3" height="0.2" depth="1.5" color="peru"></a-box>
</a-scene>Your turn: a wide shelf
Set all three sizes.
Practice task
Write a scene with a box at position 0 1 -4 that is 4 wide, 0.5 high and 1 deep.
Your answer is run and checked in the lesson. Create a free account to try it.
Rotation
rotation turns a shape. Like position it takes three numbers, but these are angles in degrees.
The second number spins the shape like a top. The first tips it forwards or backwards, and the third rolls it sideways.
<a-scene>
<a-box position="0 1.5 -3" rotation="0 45 0" color="mediumseagreen"></a-box>
</a-scene>Your turn: turn a box
Spin a box so that a corner faces you.
Practice task
Write a scene with a box at position 0 1 -3, turned by 45 degrees like a top: rotation 0 45 0.
Your answer is run and checked in the lesson. Create a free account to try it.