StatReveal data
One big number that counts up, a bar that fills to match, and a label under it.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| value* | number | ||
| prefix | string | "" | |
| suffix | string | "" | |
| decimals | number (0 to 3) | 0 | |
| label | string | "" | |
| size | number (60 to 400) | 250 | the number's type size; the bar and label follow |
| bar | number (0 to 1) | 0.64 | how full the bar ends up |
| color | color | "accent" | |
| bounce | number (0 to 0.9) | 0.35 | |
| seconds | number (0.2 to 4) | 1.1 | how long the count takes |
* 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 |
| value | text |
| bar | shape |
| label | text |
Example#
{"el": "StatReveal", "value": 82, "suffix": "%", "label": "of drafts need no second pass"}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",
"gap": 26,
"align": "center",
"children": [
{
"el": "text",
"id": "value",
"text": "0",
"size": "$size",
"weight": 800,
"color": "$color",
"motion": [
{
"do": "enter",
"from": "pop",
"curve": {"spring": {"bounce": "$bounce", "duration": 0.6}}
},
{
"do": "count",
"to": "$value",
"prefix": "$prefix",
"suffix": "$suffix",
"decimals": "$decimals",
"curve": {"ease": "outExpo", "duration": "$seconds"}
}
]
},
{
"el": "box",
"w": "=size*2.1",
"h": 24,
"radius": 12,
"fill": "rgba(128,128,140,.22)",
"clip": true,
"align": "start",
"motion": [{"do": "enter", "from": "fade", "delay": 0.15}],
"children": [
{
"el": "shape",
"id": "bar",
"kind": "rect",
"w": "=size*2.1*bar",
"h": 24,
"radius": 12,
"fill": "$color",
"origin": "left",
"motion": [
{
"do": "enter",
"from": {"scaleX": 0},
"delay": 0.25,
"curve": {"ease": "outExpo", "duration": "$seconds"}
}
]
}
]
},
{
"el": "text",
"id": "label",
"text": "$label",
"size": "=max(34,size*0.21)",
"weight": 600,
"color": "muted",
"align": "center",
"maxW": "=max(300,size*3.2)",
"motion": [{"do": "enter", "from": "rise", "delay": 0.35}]
}
]
}