Track active Chat Bubbles
A reference to the chat bubbles HTML container in which rendered bubbles should live
Create a chat bubble message for a certain token which is synchronized for display across all connected clients.
The speaking Token Document
The spoken message text
A promise which resolves with the created bubble HTML, or null
Speak a message as a particular Token, displaying it as a chat bubble
The speaking Token
The spoken message text
Options which affect the bubble appearance
A Promise which resolves to the created bubble HTML element, or null
Determine the length of time for which to display a chat bubble. Research suggests that average reading speed is 200 words per minute. Since these are short-form messages, we multiply reading speed by 1.5. Clamp the result between 1 second (minimum) and 20 seconds (maximum)
The HTML message
The number of milliseconds for which to display the message
Clear any existing chat bubble for a certain Token
Render the HTML template for the chat bubble
Template data
The rendered HTML
Before displaying the chat message, determine it's constrained and unconstrained dimensions
The message content
The rendered message dimensions
Assign styling parameters to the chat bubble, toggling either a left or right display (randomly)
The speaking Token
Chat bubble content
Positioning data
Activate Socket event listeners which apply to the ChatBubbles UI.
The active web socket connection
The Chat Bubble Class This application displays a temporary message sent from a particular Token in the active Scene. The message is displayed on the HUD layer just above the Token.