Compare data
Before and after, side by side: the old way dims and shrinks as the new way pops in.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| before* | string | ||
| after* | string | ||
| labelBefore | string | "Before" | |
| labelAfter | string | "After" | |
| at | time | 1.2 | when the new way arrives |
* 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 |
Example#
{"el": "Compare", "before": "3 hours in an editor", "after": "4 minutes", "at": 1.4}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": "row",
"gap": 30,
"align": "center",
"children": [
{
"el": "box",
"surface": "card",
"w": 440,
"gap": 18,
"motion": [
{"do": "enter", "from": "slide-right"},
{"do": "to", "pose": {"scale": 0.9, "opacity": 0.45}, "at": "$at", "curve": "gentle"}
],
"children": [
{
"el": "text",
"text": "$labelBefore",
"size": 36,
"weight": 600,
"color": "muted",
"upper": true,
"tracking": 0.08
},
{"el": "text", "text": "$before", "size": 60, "weight": 800, "maxW": 360}
]
},
{
"el": "box",
"surface": "card",
"fill": "accent",
"w": 440,
"gap": 18,
"motion": [
{
"do": "enter",
"from": {"scale": 0.5, "x": -80, "opacity": 0},
"at": "$at",
"curve": "bouncy"
}
],
"children": [
{
"el": "text",
"text": "$labelAfter",
"size": 36,
"weight": 600,
"color": "white",
"opacity": 0.75,
"upper": true,
"tracking": 0.08
},
{
"el": "text",
"text": "$after",
"size": 60,
"weight": 800,
"color": "white",
"maxW": 360
}
]
}
]
}