Text and movement
Put words in the scene and make a shape move by itself.
Your scene is drawn in 3D by your own browser, inside this tab. No headset needed.
Text
<a-text> shows words in the scene. The words go in its value attribute, not between the tags.
align="center" centres the words on the text's position, and color works as it does on shapes.
<a-scene>
<a-sky color="midnightblue"></a-sky>
<a-text value="Hello, VR" position="0 2 -3" align="center" color="white"></a-text>
</a-scene>Your turn: a sign
Words go in the value attribute.
Practice task
Write a scene with text that says Welcome at position 0 2 -3.
Your answer is run and checked in the lesson. Create a free account to try it.
Movement
The animation attribute changes one of a shape's other attributes over time.
Its value is a short list of settings separated by semicolons. property is what to change, to is the value to reach, and dur is how long it takes, in thousandths of a second.
loop: true starts it again each time it finishes.
<a-scene>
<a-box position="0 1.5 -3" color="tomato" animation="property: rotation; to: 0 360 0; dur: 4000; loop: true"></a-box>
</a-scene>Your turn: a spinning box
Make a box turn for ever.
Practice task
Write a scene with a box at position 0 1 -3 that has an animation on its rotation, with loop set to true.
Your answer is run and checked in the lesson. Create a free account to try it.
On a headset
Everything in this course is a web page. Put it on the web and anyone can open it by its address.
On a phone or computer it shows as a 3D view you can look around. In a VR headset's browser, the same page offers a button to step inside the scene.
Nothing in your code changes between the two.