Receipt data
A bill: a title, a dashed rule, and lines that get a tick or a cross one by one.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| title | string | "Invoice" | |
| items* | list of object | ||
| each | number (0 to 5) | 0.5 | |
| fill | color | "paper" | |
| ink | color | "black" |
* 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 |
| bill | box |
Example#
{
"el": "Receipt",
"items": [{"text": "You paid", "ok": true}, {"text": "You got the service", "ok": false}]
}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": "bill",
"w": 620,
"fill": "$fill",
"border": "$ink",
"borderW": 5,
"hard": 10,
"pad": 40,
"gap": 22,
"align": "stretch",
"rotate": -2,
"motion": [{"do": "enter", "from": {"y": -500, "rotate": 8, "opacity": 0}, "curve": "heavy"}],
"children": [
{
"el": "text",
"text": "$title",
"size": 46,
"weight": 800,
"color": "$ink",
"align": "center"
},
{"el": "box", "h": 4, "pattern": "lines", "cell": 14, "ink": "$ink"},
{
"el": "box",
"gap": 18,
"align": "stretch",
"motion": [{"do": "stagger", "each": "$each", "delay": 0.5}],
"children": [
{
"$each": "$items",
"as": "it",
"node": {
"el": "box",
"dir": "row",
"justify": "between",
"align": "center",
"children": [
{
"el": "text",
"text": "$it.text",
"size": 40,
"weight": 700,
"color": "$ink",
"motion": [{"do": "enter", "from": {"x": 30, "opacity": 0}, "curve": "punchy"}]
},
{
"el": "icon",
"name": {"$if": "$it.ok", "then": "check", "else": "x"},
"size": 50,
"color": {"$if": "$it.ok", "then": "good", "else": "bad"},
"strokeW": 3.4,
"motion": [{"do": "draw", "delay": 0.2, "curve": "snap"}]
}
]
}
}
]
}
]
}