Advanced animation system for creating dynamic, procedural, and expression-based animations beyond simple keyframes.
The animation system supports several types beyond traditional keyframes:
These advanced animations are defined in the animations array property of elements.
Node Animations (animations array):
Keyframes (keyframes array):
When multiple animation methods target the same property:
| Prop | Type | Required | Example | Value Range | Description |
|---|---|---|---|---|---|
| type | string | true | - | expression | procedural | sequence | path | The type of animation. |
| enabled | boolean | false | - | - | Whether the animation is active. |
| target | string | true | - | - | The property path to animate (e.g., "x", "rotation", "scaleX"). |
| startTime | number | false | - | - | Start time of the animation relative to element start, in seconds. |
| duration | number | false | - | - | Duration of the animation in seconds. For looping animations, this is the loop period. |
| loop | boolean | false | - | - | Whether the animation loops. |
| blendMode | string | false | - | replace | add | multiply | How this animation combines with others: replace (override), add (sum), multiply (scale). |
| blendWeight | number | false | - | - | The strength/influence of this animation (0-1). Used for blending multiple animations. |
Expressions are JavaScript code evaluated per frame, with access to animation context variables.
{
time: number; // Current absolute time (seconds)
localTime: number; // Time relative to element start
duration: number; // Element duration
progress: number; // Normalized progress (0-1)
index: number; // Element index in group
total: number; // Total elements in group
fps: number; // Frames per second
width: number; // Canvas width
height: number; // Canvas height
value: any; // Current property value
}
Bounce animation using Math functions:
1{
2"id": "element-1",
3"type": "Image",
4"start": 0,
5"duration": 5,
6"animations": [
7 {
8 "type": "expression",
9 "target": "y",
10 "enabled": true,
11 "expression": "100 + Math.abs(Math.sin(localTime * 3)) * 200",
12 "startTime": 0,
13 "duration": 5,
14 "loop": true
15 }
16]
17}
18Combine multiple effects:
1{
2"animations": [
3 {
4 "type": "expression",
5 "target": "rotation",
6 "expression": "(localTime * 2 * Math.PI / duration) + Math.sin(localTime * 4) * 0.1",
7 "loop": true
8 },
9 {
10 "type": "expression",
11 "target": "scaleX",
12 "expression": "1 + Math.sin(localTime * 5) * 0.2",
13 "loop": true
14 }
15]
16}
17Built-in animation patterns with configurable parameters.
1{
2"animations": [
3 {
4 "type": "procedural",
5 "proceduralType": "wiggle",
6 "target": "rotation",
7 "enabled": true,
8 "frequency": 2,
9 "amplitude": 0.1,
10 "loop": true
11 }
12]
13}
14Step-based animations that change values at specific intervals.
| Prop | Type | Required | Example | Value Range | Description |
|---|---|---|---|---|---|
| values | array | true | - | - | Array of values to step through. |
| stepDuration | number | true | - | - | Duration of each step in seconds. |
| loop | boolean | false | - | - | Whether to loop the sequence. |
Text cycling through different sizes:
1{
2"animations": [
3 {
4 "type": "sequence",
5 "target": "fontSize",
6 "enabled": true,
7 "values": [24, 32, 40, 32, 24],
8 "stepDuration": 0.5,
9 "loop": true
10 }
11]
12}
13Animate elements along Bezier curve paths.
| Prop | Type | Required | Example | Value Range | Description |
|---|---|---|---|---|---|
| path | string | array | true | - | - | SVG path data (d attribute) or array of path points. |
| autoRotate | boolean | false | - | - | Whether to automatically rotate element to follow path tangent. |
| duration | number | true | - | - | Time to complete the full path. |
Circular motion:
1{
2"animations": [
3 {
4 "type": "path",
5 "target": "position",
6 "enabled": true,
7 "path": "M 100,100 a 200,200 0 1,1 0,1 Z",
8 "autoRotate": true,
9 "duration": 4,
10 "loop": true
11 }
12]
13}
14The target property uses dot notation to specify nested properties:
"x", "y", "rotation""scale.x", "position.y""colors[0]", "points[2].x"{
"target": "x" // Element's x position
"target": "scaleX" // Horizontal scale
"target": "alpha" // Opacity
"target": "fill.color" // Fill color (if fill is object)
"target": "points[0].x" // First point's x coordinate
}
Control how animations combine when multiple target the same property:
{
"blendMode": "replace",
"blendWeight": 1.0
}
Completely replaces the property value.
{
"blendMode": "add",
"blendWeight": 0.5
}
Adds to the existing value (weighted). Useful for accumulating offsets.
{
"blendMode": "multiply",
"blendWeight": 1.0
}
Multiplies the existing value. Useful for scaling effects.
Combining different animation types:
1{
2"id": "animated-element",
3"type": "Shape",
4"animations": [
5 {
6 "type": "expression",
7 "target": "x",
8 "expression": "width / 2 + Math.sin(localTime * 2) * 300",
9 "blendMode": "replace",
10 "loop": true
11 },
12 {
13 "type": "procedural",
14 "proceduralType": "wiggle",
15 "target": "rotation",
16 "frequency": 3,
17 "amplitude": 0.2,
18 "blendMode": "add",
19 "blendWeight": 0.5
20 },
21 {
22 "type": "sequence",
23 "target": "alpha",
24 "values": [1, 0.8, 1],
25 "stepDuration": 0.3,
26 "loop": true,
27 "blendMode": "multiply"
28 }
29],
30"keyframes": [
31 {
32 "id": "kf-1",
33 "time": 0,
34 "stateObj": { "scaleX": 1 }
35 },
36 {
37 "id": "kf-2",
38 "time": 2,
39 "stateObj": { "scaleX": 1.5 }
40 }
41]
42}
43In this example:
startTime and duration are relative to element's start timelocalTime in expressions starts at 0 when the element beginsduration boundaryenabled: truetarget property exists on the elementstartTime is within element's duration{
"type": "expression",
"target": "x",
"expression": "value + (targetX - value) * 0.1"
}
{
"type": "expression",
"target": "scaleY",
"expression": "1 + Math.exp(-localTime * 3) * Math.cos(localTime * 8) * 0.5"
}
{
"type": "procedural",
"proceduralType": "wiggle",
"target": "x",
"frequency": 10,
"amplitude": 5
}
{
"type": "expression",
"target": "alpha",
"expression": "Math.max(0, Math.min(1, (localTime - index * 0.1) * 2))"
}