Esempi
Il documento più piccolo che funziona: una forma, nessuna animazione. Tutto ciò che non c'è ha un valore predefinito.
{
"formato": "icone",
"versione": 1,
"set": {
"id": "esempi",
"name": "Esempi",
"icons": [
{
"id": "spunta",
"name": "spunta",
"size": { "w": 24, "h": 24 },
"states": [
{
"id": "s1",
"name": "Fermo",
"rootId": "root",
"nodes": {
"root": {
"id": "root",
"geometry": { "kind": "group" },
"childIds": ["segno"]
},
"segno": {
"id": "segno",
"name": "Segno",
"parentId": "root",
"geometry": {
"kind": "path",
"commands": [
{ "type": "M", "x": 5, "y": 12.5 },
{ "type": "L", "x": 10, "y": 17.5 },
{ "type": "L", "x": 19, "y": 7 }
]
},
"style": {
"fill": { "kind": "none" },
"stroke": { "kind": "currentColor" },
"strokeWidth": 2
}
}
}
}
],
"transitions": []
}
]
}
}
Due fotogrammi che usano gli stessi id. È il punto centrale del formato: id uguali significano abbinamento esatto, e il motore non deve indovinare niente.
{
"formato": "icone",
"versione": 1,
"set": {
"id": "esempi",
"name": "Esempi",
"icons": [
{
"id": "menu",
"name": "menu",
"size": { "w": 24, "h": 24 },
"states": [
{
"id": "aperto",
"name": "Menu",
"rootId": "root",
"nodes": {
"root": { "id": "root", "geometry": { "kind": "group" }, "childIds": ["alta", "mezza", "bassa"] },
"alta": {
"id": "alta",
"name": "Barra alta",
"parentId": "root",
"geometry": { "kind": "line", "x1": 4, "y1": 7, "x2": 20, "y2": 7 },
"style": { "fill": { "kind": "none" }, "stroke": { "kind": "currentColor" }, "strokeWidth": 2 }
},
"mezza": {
"id": "mezza",
"name": "Barra di mezzo",
"parentId": "root",
"geometry": { "kind": "line", "x1": 4, "y1": 12, "x2": 20, "y2": 12 },
"style": { "fill": { "kind": "none" }, "stroke": { "kind": "currentColor" }, "strokeWidth": 2 }
},
"bassa": {
"id": "bassa",
"name": "Barra bassa",
"parentId": "root",
"geometry": { "kind": "line", "x1": 4, "y1": 17, "x2": 20, "y2": 17 },
"style": { "fill": { "kind": "none" }, "stroke": { "kind": "currentColor" }, "strokeWidth": 2 }
}
}
},
{
"id": "chiuso",
"name": "Chiudi",
"rootId": "root",
"nodes": {
"root": { "id": "root", "geometry": { "kind": "group" }, "childIds": ["alta", "mezza", "bassa"] },
"alta": {
"id": "alta",
"name": "Barra alta",
"parentId": "root",
"geometry": { "kind": "line", "x1": 4, "y1": 7, "x2": 20, "y2": 7 },
"transform": { "y": 5, "rotation": 45 },
"style": { "fill": { "kind": "none" }, "stroke": { "kind": "currentColor" }, "strokeWidth": 2 }
},
"mezza": {
"id": "mezza",
"name": "Barra di mezzo",
"parentId": "root",
"geometry": { "kind": "line", "x1": 4, "y1": 12, "x2": 20, "y2": 12 },
"style": { "fill": { "kind": "none" }, "stroke": { "kind": "currentColor" }, "strokeWidth": 2, "opacity": 0 }
},
"bassa": {
"id": "bassa",
"name": "Barra bassa",
"parentId": "root",
"geometry": { "kind": "line", "x1": 4, "y1": 17, "x2": 20, "y2": 17 },
"transform": { "y": -5, "rotation": -45 },
"style": { "fill": { "kind": "none" }, "stroke": { "kind": "currentColor" }, "strokeWidth": 2 }
}
}
}
],
"transitions": [
{
"id": "t1",
"kind": "smart",
"fromStateId": "aperto",
"toStateId": "chiuso",
"timing": { "duration": 280, "easing": { "kind": "cubic", "p1x": 0.4, "p1y": 0, "p2x": 0.2, "p2y": 1 } },
"trigger": { "kind": "toggle" }
}
]
}
]
}
}
trimEnd da 0 a 1 disegna il tratto, spin aggiunge un giro intero, loop lo ripete. Tre campi per un caricatore.
{
"formato": "icone",
"versione": 1,
"set": {
"id": "esempi",
"name": "Esempi",
"size": { "w": 24, "h": 24 },
"tokens": [{ "id": "accento", "name": "Accento", "color": "#5b5bd6" }],
"icons": [
{
"id": "caricamento",
"name": "caricamento",
"size": { "w": 24, "h": 24 },
"states": [
{
"id": "vuoto",
"name": "Vuoto",
"rootId": "root",
"nodes": {
"root": { "id": "root", "geometry": { "kind": "group" }, "childIds": ["pista", "arco"] },
"pista": {
"id": "pista",
"name": "Pista",
"parentId": "root",
"geometry": { "kind": "ellipse", "cx": 12, "cy": 12, "rx": 9, "ry": 9 },
"style": {
"fill": { "kind": "none" },
"stroke": { "kind": "currentColor" },
"strokeWidth": 2,
"strokeOpacity": 0.2
}
},
"arco": {
"id": "arco",
"name": "Arco",
"parentId": "root",
"geometry": { "kind": "ellipse", "cx": 12, "cy": 12, "rx": 9, "ry": 9 },
"transform": { "rotation": -90, "originX": 0.5, "originY": 0.5 },
"style": {
"fill": { "kind": "none" },
"stroke": { "kind": "token", "tokenId": "accento" },
"strokeWidth": 2,
"strokeLineCap": "round",
"trimStart": 0,
"trimEnd": 0
}
}
}
},
{
"id": "pieno",
"name": "Pieno",
"rootId": "root",
"nodes": {
"root": { "id": "root", "geometry": { "kind": "group" }, "childIds": ["pista", "arco"] },
"pista": {
"id": "pista",
"name": "Pista",
"parentId": "root",
"geometry": { "kind": "ellipse", "cx": 12, "cy": 12, "rx": 9, "ry": 9 },
"style": {
"fill": { "kind": "none" },
"stroke": { "kind": "currentColor" },
"strokeWidth": 2,
"strokeOpacity": 0.2
}
},
"arco": {
"id": "arco",
"name": "Arco",
"parentId": "root",
"geometry": { "kind": "ellipse", "cx": 12, "cy": 12, "rx": 9, "ry": 9 },
"transform": { "rotation": 270, "originX": 0.5, "originY": 0.5 },
"style": {
"fill": { "kind": "none" },
"stroke": { "kind": "token", "tokenId": "accento" },
"strokeWidth": 2,
"strokeLineCap": "round",
"trimStart": 0,
"trimEnd": 1
}
}
}
}
],
"transitions": [
{
"id": "t1",
"kind": "smart",
"fromStateId": "vuoto",
"toStateId": "pieno",
"timing": { "duration": 1200, "easing": { "kind": "cubic", "p1x": 0.4, "p1y": 0, "p2x": 0.2, "p2y": 1 } },
"nodeMotion": { "arco": { "spin": 1 } },
"loop": { "mode": "loop", "count": 0, "hold": 200 },
"trigger": { "kind": "none" }
}
]
}
]
}
}