Cursor data
A mouse pointer that glides along a path of points and clicks at the end (a ring pulses out). Place it with at, then give the path as pixel offsets from there.
Props#
| Prop | Type | Default | Notes |
|---|---|---|---|
| path* | list of point | [[x, y], …] pixel offsets from where it is placed, starting [0, 0] | |
| at | time | 0 | when it starts moving |
| seconds | number (0.2 to 6) | 1.1 | |
| size | number (30 to 240) | 90 | |
| color | color | "ink" |
* 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": "Cursor", "place": [0.2, 0.8], "path": [[0, 0], [260, -340]], "at": 1.5}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": 10,
"h": 10,
"motion": [
{"do": "enter", "from": "fade", "at": "$at"},
{
"do": "along",
"points": "$path",
"at": "$at",
"curve": {"ease": "inOut", "duration": "$seconds"}
}
],
"children": [
{
"el": "shape",
"kind": "circle",
"w": "=size*1.3",
"fill": "transparent",
"stroke": "accent",
"strokeW": 6,
"motion": [
{"do": "enter", "from": "shrink", "at": "$at", "delay": "$seconds", "curve": "snap"},
{
"do": "exit",
"to": {"scale": 2.4, "opacity": 0},
"at": "$at",
"delay": "=seconds+0.08",
"curve": {"ease": "out", "duration": 0.5}
}
]
},
{
"el": "icon",
"name": "cursor",
"size": "$size",
"color": "white",
"fill": "$color",
"strokeW": 1.6,
"motion": [
{
"do": "to",
"pose": {"scale": 0.8},
"at": "$at",
"delay": "$seconds",
"curve": {"ease": "out", "duration": 0.1}
},
{"do": "to", "pose": {}, "at": "$at", "delay": "=seconds+0.14", "curve": "bouncy"}
]
}
]
}