# `Dala.Media.Animation`
[🔗](https://github.com/manhvu/dala/blob/main/lib/dala/media/animation.ex#L1)

Frame-clock driven animation system.

Animations are driven by the frame clock, not by setInterval. This ensures
smooth, jank-free animations that are synchronized with the render pipeline.

Architecture:
    FrameClock → AnimationSystem → SceneGraph Update

## Example

    # Animate a node's opacity from 0 to 1 over 500ms
    Dala.Media.Animation.animate(scene, node_id, :opacity, %{
      from: 0.0,
      to: 1.0,
      duration_ms: 500,
      easing: :ease_in_out
    })

    # Animate position
    Dala.Media.Animation.animate(scene, node_id, :position, %{
      from: {0, 0},
      to: {100, 200},
      duration_ms: 1000,
      easing: :spring
    })

# `anim_ref`

```elixir
@type anim_ref() :: pid()
```

# `easing`

```elixir
@type easing() :: :linear | :ease_in | :ease_out | :ease_in_out | :spring | :bounce
```

# `animate`

```elixir
@spec animate(anim_ref(), reference(), atom(), map()) ::
  {:ok, reference()} | {:error, term()}
```

Animate a property on a scene node.

# `cancel`

```elixir
@spec cancel(anim_ref(), reference()) :: :ok
```

Cancel an animation.

# `cancel_all`

```elixir
@spec cancel_all(anim_ref(), reference()) :: :ok
```

Cancel all animations for a node.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Start the animation system, linked to a clock.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
