StatChip data
A small card for a corner of the frame: a number that counts up, with a label.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| value | number | 0 | |
| label | string | "" | |
| prefix | string | "" | |
| suffix | string | "" | |
| word | string | "" | the figure as the speaker says it, when it is not plain digits ("a billion"): shown instead of the count |
| fill | color | overrides the surface's fill | |
| ink | color | "ink" | |
| accent | color | "accent" | |
| radius | number (0 to 200) | overrides the surface's corner |
* 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 |
| chip | box |
| value | text |
| label | text |
Example#
{"el": "StatChip", "value": 20, "suffix": " yrs", "label": "of experience"}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",
"id": "chip",
"surface": "card",
"fill": "$fill",
"radius": "$radius",
"pad": [26, 42],
"gap": 0,
"align": "start",
"motion": [{"do": "enter", "from": {"x": -90, "opacity": 0}, "curve": "punchy"}],
"children": [
{
"el": "text",
"id": "value",
"text": {"$if": "$word", "then": "$word", "else": "0"},
"size": {"$if": "$word", "then": 92, "else": 116},
"weight": 800,
"color": "$accent",
"motion": {
"$if": "$word",
"then": [{"do": "enter", "from": "pop", "delay": 0.1, "curve": "bouncy"}],
"else": [
{
"do": "count",
"to": "$value",
"prefix": "$prefix",
"suffix": "$suffix",
"delay": 0.1,
"curve": {"ease": "outExpo", "duration": 0.9}
}
]
}
},
{
"el": "text",
"id": "label",
"text": "$label",
"size": 38,
"weight": 600,
"color": "$ink",
"opacity": 0.72
}
]
}