PercentRing data
A percentage: a ring that fills to it while the number counts up, with a label.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| value* | number (0 to 100) | ||
| label | string | "" | |
| ink | color | "ink" | |
| accent | color | "accent" |
* 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 |
| card | box |
| ring | shape |
| value | text |
| label | text |
Example#
{"el": "PercentRing", "value": 72, "label": "watch to the end"}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": "card",
"surface": "card",
"pad": [34, 40],
"gap": 16,
"align": "center",
"motion": [{"do": "enter", "from": "pop", "curve": "bouncy"}],
"children": [
{
"el": "box",
"dir": "stack",
"w": 250,
"h": 250,
"children": [
{
"el": "shape",
"kind": "ring",
"w": 230,
"h": 230,
"stroke": "$ink",
"strokeW": 20,
"fill": "transparent",
"opacity": 0.18
},
{
"el": "shape",
"id": "ring",
"kind": "ring",
"w": 230,
"h": 230,
"stroke": "$accent",
"strokeW": 20,
"fill": "transparent",
"progress": "=value/100",
"motion": [{"do": "draw", "delay": 0.15, "curve": {"ease": "outExpo", "duration": 1}}]
},
{
"el": "text",
"id": "value",
"text": "0",
"size": 70,
"weight": 800,
"color": "$ink",
"motion": [
{
"do": "count",
"to": "$value",
"suffix": "%",
"delay": 0.15,
"curve": {"ease": "outExpo", "duration": 1}
}
]
}
]
},
{
"el": "text",
"id": "label",
"text": "$label",
"size": 36,
"weight": 600,
"color": "$ink",
"opacity": 0.8,
"align": "center",
"maxW": 420
}
]
}