# Easing and Springs

21 easing curves, three spring presets, custom springs, cubic-bezier and steps.

An easing shapes the timing between two keys. Most are strings; parametric ones are single-key objects.

```json title="apps/docs/examples/easing.json"
{
  "camera": { "position": [0, 0, 9], "target": [0, 0, 0], "fov": 45 },
  "lighting": { "rig": "neon_rim" },
  "environment": { "background": { "solid": "#0a0a12" } },
  "post": { "bloom": 0.8 },
  "nodes": {
    "linear": {
      "transform": { "position": [-3, 2.2, 0] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.3 } },
        "material": "preset:neon"
      },
      "color": "#ff2ec4"
    },
    "linear_label": {
      "transform": { "position": [-5.2, 2.2, 0] },
      "text": {
        "content": "linear",
        "font": "jetbrains_mono",
        "size": 0.2,
        "align": "left"
      }
    },
    "ease_out_cubic": {
      "transform": { "position": [-3, 1.3000000000000003, 0] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.3 } },
        "material": "preset:neon"
      },
      "color": "#00e5ff"
    },
    "ease_out_cubic_label": {
      "transform": { "position": [-5.2, 1.3000000000000003, 0] },
      "text": {
        "content": "ease_out_cubic",
        "font": "jetbrains_mono",
        "size": 0.2,
        "align": "left"
      }
    },
    "ease_out_back": {
      "transform": { "position": [-3, 0.40000000000000013, 0] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.3 } },
        "material": "preset:neon"
      },
      "color": "#f2c230"
    },
    "ease_out_back_label": {
      "transform": { "position": [-5.2, 0.40000000000000013, 0] },
      "text": {
        "content": "ease_out_back",
        "font": "jetbrains_mono",
        "size": 0.2,
        "align": "left"
      }
    },
    "ease_out_elastic": {
      "transform": { "position": [-3, -0.5, 0] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.3 } },
        "material": "preset:neon"
      },
      "color": "#7cf27c"
    },
    "ease_out_elastic_label": {
      "transform": { "position": [-5.2, -0.5, 0] },
      "text": {
        "content": "ease_out_elastic",
        "font": "jetbrains_mono",
        "size": 0.2,
        "align": "left"
      }
    },
    "ease_out_bounce": {
      "transform": { "position": [-3, -1.4, 0] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.3 } },
        "material": "preset:neon"
      },
      "color": "#ff8a3d"
    },
    "ease_out_bounce_label": {
      "transform": { "position": [-5.2, -1.4, 0] },
      "text": {
        "content": "ease_out_bounce",
        "font": "jetbrains_mono",
        "size": 0.2,
        "align": "left"
      }
    },
    "spring_bouncy": {
      "transform": { "position": [-3, -2.3, 0] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.3 } },
        "material": "preset:neon"
      },
      "color": "#b48cff"
    },
    "spring_bouncy_label": {
      "transform": { "position": [-5.2, -2.3, 0] },
      "text": {
        "content": "spring_bouncy",
        "font": "jetbrains_mono",
        "size": 0.2,
        "align": "left"
      }
    }
  },
  "timeline": {
    "duration": 3,
    "loop": "once",
    "tracks": {
      "linear": {
        "target": "linear",
        "property": "position",
        "keyframes": [
          { "t": 0.2, "value": [-3, 2.2, 0], "easing": "linear" },
          { "t": 2.2, "value": [3, 2.2, 0] },
          { "t": 3, "value": [3, 2.2, 0] }
        ]
      },
      "ease_out_cubic": {
        "target": "ease_out_cubic",
        "property": "position",
        "keyframes": [
          {
            "t": 0.2,
            "value": [-3, 1.3000000000000003, 0],
            "easing": "ease_out_cubic"
          },
          { "t": 2.2, "value": [3, 1.3000000000000003, 0] },
          { "t": 3, "value": [3, 1.3000000000000003, 0] }
        ]
      },
      "ease_out_back": {
        "target": "ease_out_back",
        "property": "position",
        "keyframes": [
          {
            "t": 0.2,
            "value": [-3, 0.40000000000000013, 0],
            "easing": "ease_out_back"
          },
          { "t": 2.2, "value": [3, 0.40000000000000013, 0] },
          { "t": 3, "value": [3, 0.40000000000000013, 0] }
        ]
      },
      "ease_out_elastic": {
        "target": "ease_out_elastic",
        "property": "position",
        "keyframes": [
          { "t": 0.2, "value": [-3, -0.5, 0], "easing": "ease_out_elastic" },
          { "t": 2.2, "value": [3, -0.5, 0] },
          { "t": 3, "value": [3, -0.5, 0] }
        ]
      },
      "ease_out_bounce": {
        "target": "ease_out_bounce",
        "property": "position",
        "keyframes": [
          { "t": 0.2, "value": [-3, -1.4, 0], "easing": "ease_out_bounce" },
          { "t": 2.2, "value": [3, -1.4, 0] },
          { "t": 3, "value": [3, -1.4, 0] }
        ]
      },
      "spring_bouncy": {
        "target": "spring_bouncy",
        "property": "position",
        "keyframes": [
          { "t": 0.2, "value": [-3, -2.3, 0], "easing": "spring_bouncy" },
          { "t": 2.2, "value": [3, -2.3, 0] },
          { "t": 3, "value": [3, -2.3, 0] }
        ]
      }
    }
  }
}
```

![Render of easing](/renders/easing.gif)

## Curves

- `linear`
- `ease_in_*`, `ease_out_*` and `ease_in_out_*` for `sine`, `quad`, `cubic`, `quart`, `expo` and `back`
- `ease_out_elastic` and `ease_out_bounce`
- `spring_gentle`, `spring_bouncy` and `spring_snappy`
- `{"spring": {"stiffness": 170, "damping": 12, "mass": 1}}`: a custom damped spring
- `{"cubic_bezier": [0.2, 0.8, 0.2, 1]}`: CSS-style
- `{"steps": 4}`: jump in steps

## Choosing One

- Entrances: `ease_out_cubic`, `ease_out_expo`, or `ease_out_back` for a little overshoot.
- Interactive transitions: springs. They feel physical and settle naturally.
- Loops and constant motion: `linear`, or a [smooth curve](/docs/features/timeline#smooth-curves).

## API Reference

### Easing

An easing curve. Most are plain strings (`"ease_out_cubic"`); parametric ones are objects: `{"spring": {"stiffness": 170, "damping": 12}}`, `{"cubic_bezier": [0.2, 0.8, 0.2, 1]}`, `{"steps": 4}`.

| Value | Description |
| --- | --- |
| `"linear"` |  |
| `"ease_in_sine"` |  |
| `"ease_out_sine"` |  |
| `"ease_in_out_sine"` |  |
| `"ease_in_quad"` |  |
| `"ease_out_quad"` |  |
| `"ease_in_out_quad"` |  |
| `"ease_in_cubic"` |  |
| `"ease_out_cubic"` |  |
| `"ease_in_out_cubic"` |  |
| `"ease_in_quart"` |  |
| `"ease_out_quart"` |  |
| `"ease_in_out_quart"` |  |
| `"ease_in_expo"` |  |
| `"ease_out_expo"` |  |
| `"ease_in_out_expo"` |  |
| `"ease_in_back"` |  |
| `"ease_out_back"` |  |
| `"ease_in_out_back"` |  |
| `"ease_out_elastic"` |  |
| `"ease_out_bounce"` |  |
| `"spring_gentle"` | Soft spring, minimal overshoot. |
| `"spring_bouncy"` | Playful spring with visible overshoot. |
| `"spring_snappy"` | Fast, crisp spring. |

- `{"spring": Spring}`: Custom damped spring (mass-spring-damper step response).

- `{"cubic_bezier": [x, y, z, w]}`: CSS-style cubic bezier `[x1, y1, x2, y2]`.

- `{"steps": integer}`: Jump in N discrete steps.
### Spring

Damped spring parameters.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `damping` | `number (≥ 0)` | `26` | Friction. Lower is bouncier. |
| `mass` | `number (≥ 0.01)` | `1` | Mass. Heavier is slower and swings further. |
| `stiffness` | `number (≥ 0.01)` | `170` | Spring strength. Higher is faster. |
