A guide that lives on your website
Atlas is on this page now, at the bottom right. He shows visitors round, finds things, checks the page and answers questions. Try him here, then add one to your own site with two lines of HTML.
Add him to your site
Two lines of HTML put a guide on a page: a script and an element. A third piece, your own answers, lets him take questions. Here he is on a bakery's page, with nothing changed but those two lines.
-
Load the script
Copy versonaWebComponent.js to your site. It loads A-Frame, the 3D library it draws with, by itself.
<script src="versonaWebComponent.js"></script> -
Place the guide
Point it at any rigged
.glbmodel and name the clips it has. Atlas is atlas-optimized.glb. The Settings part builds this tag for you.<versona-helper model-url="/models/your-guide.glb" idle-animation="Idle" talking-animation="Talk" scale="2.5 2.5 2.5" enable-page-interaction enable-prompt-input> </versona-helper> -
Give him answers
Without this he still tours, finds, outlines and checks the page. Questions and summaries come to you as an event; send back the text he should say.
const guide = document.querySelector('versona-helper'); guide.addEventListener('versona-prompt-received', async (event) => { const { prompt, pageIndex, respond } = event.detail; const reply = await fetch('/your-ai/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt, page: pageIndex }) }).then(r => r.json()); respond(reply.text); // he says it, and keeps it in the history });
Settings
Attributes on the versona-helper element. Change them here and Atlas changes as you do; the tag below is the one that would give you this guide.
Try them on Atlas
Only what you change is added; the rest keeps its default.
Every setting
| Attribute | What it does | If left out |
|---|---|---|
model-url | The 3D model to show, a .glb file. | none |
animation-mode | animated plays the model's clips, hovering floats it gently, static holds it still. | animated |
idle-animation | The clip he plays while waiting. Also talking-animation, pointing-animation and wave-animation. | Idle, Talk, Point, Wave |
scale | His size: one number, or three for width, height and depth. | 1 |
position | Where he stands in his corner, as three numbers. | 0 0 0 |
hover-amplitude | How far he rises and falls when hovering; hover-speed sets how fast. | 0.1, 1.0 |
enable-page-interaction | Lets him read the page: tours, finding, the outline and the checks. | off |
enable-prompt-input | Gives visitors a box to ask him questions. | off |
mouse-tracking | He turns to follow the pointer. | off |
sitemap-url | A site map he reads to search the whole site, not only this page. | none |
visible | Shows or hides him; the eye button in the corner does the same. | shown |
Control him from your code
Methods to call on the element, and the events he sends back. Press Run and watch the log on the right fill as he answers.
Methods
| Method | What it does | Try it |
|---|---|---|
say(text, ms) | Shows words in his speech bubble, for a time in milliseconds. | |
tourPageSections() | Walks the visitor through the page's headings, with Next and Previous, opening each tab on the way. | |
highlightTextOnPage(text) | Marks every place a word appears and returns them. | |
scrollToElement(target) | Scrolls to an element or an id, and marks it. | |
wave(ms) | Plays his wave. | |
showPromptInput() | Opens the box for a question. | |
offerPageHelp() | Offers a summary of the page's parts, a tour and a question. | |
createPageSummary() | Returns the page's title, headings and counts as text, ready to give to your AI. | |
toggle() | Hides him, or brings him back. |
Events
Nothing yet. Press Run, or click Atlas.
He sends these; listen for them with addEventListener.
| Event | When |
|---|---|
versona-ready | The element is set up and can take methods. |
versona-helper-click | Someone clicked him and his menu opened. Sent on the document. |
versona-prompt-received | A visitor asked a question. detail has the prompt, a pageIndex and respond(text). |
versona-prompt-responded | He has said something, an answer or any other line: detail.responseText. |
versona-reveal | He is about to go to something your page hides, such as a closed tab. Show it there and then. |
How this page answers you
When you ask Atlas something here, the page sends your question and a map of its own parts to Verse's AI. If the reply names a part of the page, he goes there and marks it; then he says the answer out loud. Ask him something and watch it travel.
- You askIn his question box.
- He hands it onAs
versona-prompt-received, with a map of the page. - The page asks the AIVerse's AI reads the question and the map.
- He goes to the partIf the answer names one.
- He says itIn his bubble, and out loud.
The page's side of it
The reply may name a part of the page; the page sends him there before he speaks.
// the reply may name a part of the page: <scroll>#settings</scroll>
const { extracted, remainingString } = extractScrollContent(reply);
extracted.forEach(id => guide.scrollToElement(id, true));
respond(remainingString);