ChatThread data
Chat bubbles that pop in from their own corner, one after another. me: true puts a bubble on the right in the accent colour.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| messages* | list of object | ||
| each | number (0 to 3) | 0.55 | |
| bounce | number (0 to 0.9) | 0.45 | |
| w | number (300 to 1060) | 900 |
* required. Every node also takes the common props: id, motion, start, place, scale, rotate, opacity, w, h. A colour is a palette name, never a value.
Parts#
Named parts can be restyled from outside without making a new component: "parts": { "root": { … } }.
| Part | Is a |
|---|---|
| root | box |
| bubble | box |
Example#
{
"el": "ChatThread",
"messages": [
{"text": "Can you cut this down to 30 seconds?"},
{"text": "Done. Want captions too?", "me": true}
]
}How it is made#
This component is plain data. Its whole definition is the tree below: copy it into a scene's components list under a new name to make your own version. See Custom components.
{
"el": "box",
"w": "$w",
"gap": 24,
"motion": [{"do": "stagger", "each": "$each"}],
"children": [
{
"$each": "$messages",
"as": "m",
"node": {
"el": "box",
"dir": "row",
"w": "fill",
"justify": {"$if": "$m.me", "then": "end", "else": "start"},
"children": [
{
"el": "box",
"id": "bubble",
"pad": [28, 40],
"radius": 46,
"shadow": 1,
"fill": {"$if": "$m.me", "then": "accent", "else": "paper"},
"origin": {"$if": "$m.me", "then": "bottom right", "else": "bottom left"},
"motion": [
{
"do": "enter",
"from": {"scale": 0.3, "y": 30, "opacity": 0},
"curve": {"spring": {"bounce": "$bounce", "duration": 0.5}}
}
],
"children": [
{
"el": "text",
"text": "$m.text",
"size": 46,
"weight": 600,
"font": "body",
"maxW": "=w*0.7",
"leading": 1.25,
"color": {"$if": "$m.me", "then": "white", "else": "ink"}
}
]
}
]
}
}
]
}