Carousel3D data
Cards on a ring in depth that keeps turning: the front card is full strength, the others fall back and dim.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| items* | list of string | ||
| radius | number (100 to 1200) | 460 | |
| period | number (-60 to 60) | 10 | seconds per full turn |
| w | number (120 to 900) | 440 | |
| h | number (120 to 1400) | 560 | |
| fill | color | "accent>night" | |
| color | color | "white" |
* 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": "Carousel3D", "items": ["Hook", "Cut", "Captions", "Music", "Post"]}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",
"perspective": 1700,
"w": 10,
"h": 10,
"children": [
{
"$each": "$items",
"node": {
"el": "box",
"id": "card",
"w": "$w",
"h": "$h",
"radius": 44,
"pad": 44,
"justify": "end",
"fill": "$fill",
"shadow": 2,
"motion": [
{"do": "enter", "from": "pop", "delay": "=index*0.08", "curve": "bouncy"},
{
"do": "drive",
"pose": {
"x": "=sin((index/count+t/period)*tau)*radius",
"z": "=cos((index/count+t/period)*tau)*radius-radius",
"rotateY": "=sin((index/count+t/period)*tau)*-32",
"opacity": "=0.3+0.7*smooth(-0.5,0.7,cos((index/count+t/period)*tau))"
}
}
],
"children": [
{
"el": "text",
"text": "$item",
"size": 60,
"weight": 800,
"color": "$color",
"maxW": "=w-88"
}
]
}
}
]
}