MomentPicture data
One of the reel's pictures in a large window with a title over it. A wide picture is cropped towards its focus and the window travels across the rest while it is up.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| src* | string | ||
| title | string | "" | |
| ratio | number (0.2 to 5) | 1.5 | |
| crop | number (0.4 to 3) | 1.3 | the window's own shape (width over height) |
| focus | number (0 to 1) | 0.5 | where across the picture the interest is |
| seconds | number (0.5 to 60) | 4 | |
| ink | color | "ink" | |
| 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 |
| title | text |
| window | box |
| picture | img |
Example#
{"el": "MomentPicture", "src": "", "title": "The editor"}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": 30,
"align": "center",
"justify": "center",
"motion": [{"do": "enter", "from": {"opacity": 0, "scale": 1.05}, "curve": "smooth"}],
"children": [
{
"el": "text",
"id": "title",
"text": "$title",
"size": "=frameW*0.062",
"weight": 800,
"color": "$ink",
"align": "center",
"maxW": "=frameW-120",
"motion": [
{
"do": "enter",
"from": {"y": 36, "opacity": 0, "blur": 6},
"delay": 0,
"curve": "smooth"
}
]
},
{
"el": "box",
"id": "window",
"dir": "stack",
"align": "start",
"justify": "start",
"clip": true,
"radius": 22,
"shadow": 3,
"w": "=min(frameW-40,(frameH-170)*crop)",
"h": "=(min(frameW-40,(frameH-170)*crop))/crop",
"motion": [
{
"do": "enter",
"from": {"y": 70, "scale": 0.94, "opacity": 0},
"delay": 0.15,
"curve": "heavy"
}
],
"children": [
{
"el": "img",
"id": "picture",
"src": "$src",
"w": "=max(min(frameW-40,(frameH-170)*crop),(min(frameW-40,(frameH-170)*crop))/crop*ratio)",
"h": "=(max(min(frameW-40,(frameH-170)*crop),(min(frameW-40,(frameH-170)*crop))/crop*ratio))/ratio",
"radius": 0,
"fit": "cover",
"motion": [
{
"do": "drive",
"pose": {
"x": "=-((max(min(frameW-40,(frameH-170)*crop),(min(frameW-40,(frameH-170)*crop))/crop*ratio))-(min(frameW-40,(frameH-170)*crop)))*clamp(focus-0.25+0.5*smooth(0.3,seconds,lt),0,1)"
}
}
]
}
]
}
]
}