WordWheel data
A vertical wheel of lines: one is in focus with an underline, the ones above and below are ghosts, and it steps to the next every "hold" seconds.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| items* | list of string | ||
| hold | number (0.2 to 20) | 1 | |
| size | number (20 to 400) | 120 | |
| gap | number (20 to 800) | 170 | |
| color | color | "ink" | |
| font | enum: display | body | mono | serif | "display" | |
| weight | number (100 to 900) | 500 |
* 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 |
| line | text |
| rule | shape |
Example#
{"el": "WordWheel", "items": ["Accurate", "Fast", "Yours"]}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",
"dir": "stack",
"w": 1600,
"h": "=gap*3",
"children": [
{
"$each": "$items",
"node": {
"el": "box",
"gap": 14,
"align": "stretch",
"motion": [
{
"do": "drive",
"pose": {
"y": "=(index-min(pos,count-1))*gap",
"opacity": "=1-0.88*clamp(abs(index-min(pos,count-1)))",
"blur": "=7*clamp(abs(index-min(pos,count-1)))",
"scale": "=1-0.1*clamp(abs(index-min(pos,count-1)))"
}
}
],
"children": [
{
"el": "text",
"id": "line",
"text": "$item",
"size": "$size",
"weight": "$weight",
"font": "$font",
"color": "$color",
"tracking": -0.03,
"align": "center"
},
{
"el": "shape",
"id": "rule",
"kind": "rect",
"w": "fill",
"h": 6,
"radius": 3,
"fill": "accent",
"origin": "left",
"motion": [{"do": "drive", "pose": {"scaleX": "=clamp(1-abs(index-min(pos,count-1))*1.6)"}}]
}
]
}
}
]
}