Skip to main content

Emotion Bubbles

An emotion bubble is a small icon (heart, exclamation mark, light bulb…) shown above a player or an event. It pops in with a bounce, follows the character if it moves, stays visible for a moment, then pops out. Emotion bubbles are built in. There is nothing to install or register.

Show a bubble

Call showEmotionBubble() on the server, on a player or on an event:
The bubble is visible to every client on the map.

Options

The second argument customizes the display:

Built-in emotions

The emotion names are typed, so your editor suggests them: confusion, question, like-break, surprise, two-dot, dollar, stars, music, like, exclamation, one-dot, jaded, star, haha, sad, beads, cross, hungry, zz, idea, happy, bead, cloud, surprise2, z, likes, empty, three-dot, circle, hungry2. The table is exported as EMOTION_BUBBLES from @rpgjs/common. It maps each name to its [column, row] cell in the icon sheet.

Use your own icons

The icon sheet is sent with the animation, so you can replace it per call. Pass the image and its grid, and frame to pick the icon:
frame is required for a name that is not in the built-in table. Without it, the client logs a warning and shows nothing.

How it works

showEmotionBubble() is a thin wrapper around showComponentAnimation() with the emotion-bubble animation id. The client registers the matching component by default, and the default icon sheet is bundled inside @rpgjs/client.