CardStack data
Cards drop onto a pile one after another, then fan out so every one can be read.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| items* | list of string | ||
| w | number (200 to 1000) | 720 | |
| spread | number (0 to 400) | 150 | pixels between cards once fanned |
| fan | number (-20 to 20) | 4 | degrees of turn per card |
| each | number (0 to 1) | 0.14 | |
| bounce | number (0 to 0.9) | 0.4 |
* 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 |
Example#
{"el": "CardStack", "items": ["Cut the pauses", "Add captions", "Pick the music"]}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": "$w",
"h": "=spread*3+220",
"motion": [{"do": "stagger", "each": "$each"}],
"children": [
{
"$each": "$items",
"node": {
"el": "box",
"id": "card",
"surface": "card",
"w": "$w",
"pad": [40, 48],
"motion": [
{
"do": "enter",
"from": {"y": -900, "rotate": -16, "opacity": 0},
"curve": {"spring": {"bounce": "$bounce", "duration": 0.7}}
},
{
"do": "to",
"pose": {"y": "=(index-(count-1)/2)*spread", "rotate": "=(index-(count-1)/2)*fan"},
"delay": 0.5,
"curve": {"spring": {"bounce": "$bounce", "duration": 0.7}}
}
],
"children": [{"el": "text", "text": "$item", "size": 58, "weight": 700}]
}
}
]
}