MomentVersus data
A full-frame before and after: the old way gets struck through, the new way pops under it.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| before* | string | ||
| after* | string | ||
| beforeLabel | string | "Before" | |
| afterLabel | string | "Now" | |
| 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 |
| old | box |
| new | box |
Example#
{"el": "MomentVersus", "before": "Three hours in an editor", "after": "One take, done"}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": 70,
"align": "center",
"justify": "center",
"motion": [{"do": "enter", "from": {"opacity": 0, "scale": 1.05}, "curve": "smooth"}],
"children": [
{
"el": "box",
"gap": 14,
"align": "center",
"motion": [
{
"do": "enter",
"from": {"y": 36, "opacity": 0, "blur": 6},
"delay": 0,
"curve": "smooth"
}
],
"children": [
{
"el": "text",
"text": "$beforeLabel",
"size": 38,
"weight": 600,
"font": "mono",
"color": "muted",
"upper": true,
"tracking": 0.14
},
{
"el": "Strike",
"delay": 0.9,
"thickness": 14,
"children": [
{
"el": "box",
"id": "old",
"surface": "card",
"w": "=frameW-220",
"pad": [36, 44],
"align": "center",
"children": [
{
"el": "text",
"text": "$before",
"size": "=frameW*0.056",
"weight": 700,
"color": "muted",
"align": "center",
"maxW": "=frameW-320"
}
]
}
]
}
]
},
{
"el": "box",
"gap": 14,
"align": "center",
"motion": [
{
"do": "enter",
"from": {"y": 90, "scale": 0.9, "opacity": 0},
"delay": 1.3,
"curve": "bouncy"
}
],
"children": [
{
"el": "text",
"text": "$afterLabel",
"size": 38,
"weight": 600,
"font": "mono",
"color": "accent",
"upper": true,
"tracking": 0.14
},
{
"el": "box",
"id": "new",
"surface": "slab",
"w": "=frameW-220",
"pad": [40, 44],
"align": "center",
"children": [
{
"el": "text",
"text": "$after",
"size": "=frameW*0.064",
"weight": 800,
"color": "white",
"align": "center",
"maxW": "=frameW-320"
}
]
}
]
}
]
}