MomentStat data
A full-frame number: it counts up huge, a rule draws under it, a line says what it is. For a figure the speaker says out loud.
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 |
| ink | color | "ink" | |
| on | string | "page" | the surface it sits on |
| frameW | number | its width, when it is not the whole frame | |
| frameH | number | its height, when it is not the whole frame |
* 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 |
| page | box |
| value | text |
| rule | shape |
| label | text |
Example#
{"el": "MomentStat", "value": 20, "suffix": " years", "label": "of doing this by hand"}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": "page",
"surface": "$on",
"w": "$frameW",
"h": "$frameH",
"gap": 40,
"align": "center",
"justify": "center",
"motion": [{"do": "enter", "from": {"opacity": 0, "scale": 1.05}, "curve": "smooth"}],
"children": [
{
"el": "text",
"id": "value",
"text": {"$if": "$word", "then": "$word", "else": "0"},
"size": {"$if": "$word", "then": "=frameW*0.19", "else": "=frameW*0.27"},
"weight": 900,
"color": "accent",
"glow": "accent",
"align": "center",
"maxW": "=frameW-160",
"motion": {
"$if": "$word",
"then": [{"do": "enter", "from": "pop", "curve": "bouncy"}],
"else": [
{"do": "enter", "from": "pop", "curve": "bouncy"},
{
"do": "count",
"to": "$value",
"prefix": "$prefix",
"suffix": "$suffix",
"delay": 0.1,
"curve": {"ease": "outExpo", "duration": 1.1}
}
]
}
},
{
"el": "shape",
"id": "rule",
"kind": "rect",
"w": "=frameW*0.36",
"h": 10,
"radius": 5,
"fill": "accent2",
"origin": "left",
"motion": [{"do": "draw", "delay": 0.35, "curve": "snap"}]
},
{
"el": "text",
"id": "label",
"text": "$label",
"size": "=frameW*0.055",
"weight": 700,
"color": "$ink",
"align": "center",
"maxW": "=frameW-220",
"motion": [
{
"do": "enter",
"from": {"y": 36, "opacity": 0, "blur": 6},
"delay": 0.5,
"curve": "smooth"
}
]
}
]
}