# `Visualize.Ease`
[🔗](https://github.com/dcoai/Visualize/blob/v0.8.3/lib/visualize/ease.ex#L1)

Easing functions for smooth animations and transitions.

Easing functions take a normalized time `t` in [0, 1] and return
a transformed value, typically also in [0, 1].

## Variants

Most easing functions come in three variants:
- `*_in` - Starts slow, accelerates (ease-in)
- `*_out` - Starts fast, decelerates (ease-out)
- `*_in_out` - Starts slow, speeds up, then slows down

## Examples

    # Apply quadratic easing to a time value
    Visualize.Ease.quad_in(0.5)  # => 0.25

    # Use with interpolation for animations
    t = 0.5
    eased_t = Visualize.Ease.cubic_in_out(t)
    current_value = start + (end - start) * eased_t

## CSS Integration

For LiveView transitions, you can use CSS easing functions instead.
These Elixir functions are useful for:
- Server-side pre-computation of animation frames
- Generating animated SVG paths
- Data-driven animations with d3-style transitions

# `back_in`

```elixir
@spec back_in(number()) :: float()
```

Back ease-in: overshoots slightly before starting.

The overshoot amount can be configured (default ~1.7).

# `back_in`

```elixir
@spec back_in(number(), number()) :: float()
```

Back ease-in with custom overshoot amount

# `back_in_out`

```elixir
@spec back_in_out(number()) :: float()
```

Back ease-in-out: overshoots at both ends

# `back_out`

```elixir
@spec back_out(number()) :: float()
```

Back ease-out: overshoots then settles at target

# `back_out`

```elixir
@spec back_out(number(), number()) :: float()
```

Back ease-out with custom overshoot amount

# `bounce_in`

```elixir
@spec bounce_in(number()) :: float()
```

Bounce ease-in: bounces at the start

# `bounce_in_out`

```elixir
@spec bounce_in_out(number()) :: float()
```

Bounce ease-in-out: bounces at both ends

# `bounce_out`

```elixir
@spec bounce_out(number()) :: float()
```

Bounce ease-out: bounces at the end (like a ball)

# `by_name`

```elixir
@spec by_name(atom()) :: (number() -&gt; float())
```

Returns an easing function by name.

## Examples

    easing = Visualize.Ease.by_name(:cubic_in_out)
    easing.(0.5)  # => 0.5

# `circle_in`

```elixir
@spec circle_in(number()) :: float()
```

Circular ease-in: 1 - sqrt(1 - t²)

# `circle_in_out`

```elixir
@spec circle_in_out(number()) :: float()
```

Circular ease-in-out

# `circle_out`

```elixir
@spec circle_out(number()) :: float()
```

Circular ease-out: sqrt(1 - (t-1)²)

# `cubic_in`

```elixir
@spec cubic_in(number()) :: float()
```

Cubic ease-in: t³

# `cubic_in_out`

```elixir
@spec cubic_in_out(number()) :: float()
```

Cubic ease-in-out

# `cubic_out`

```elixir
@spec cubic_out(number()) :: float()
```

Cubic ease-out: 1 - (1-t)³

# `elastic_in`

```elixir
@spec elastic_in(number()) :: float()
```

Elastic ease-in with spring-like oscillation.

Overshoots then settles. Amplitude and period can be configured.

# `elastic_in_out`

```elixir
@spec elastic_in_out(number()) :: float()
```

Elastic ease-in-out with spring-like oscillation

# `elastic_out`

```elixir
@spec elastic_out(number()) :: float()
```

Elastic ease-out with spring-like oscillation

# `exp_in`

```elixir
@spec exp_in(number()) :: float()
```

Exponential ease-in: 2^(10(t-1))

# `exp_in_out`

```elixir
@spec exp_in_out(number()) :: float()
```

Exponential ease-in-out

# `exp_out`

```elixir
@spec exp_out(number()) :: float()
```

Exponential ease-out: 1 - 2^(-10t)

# `frames`

```elixir
@spec frames((number() -&gt; float()), pos_integer()) :: [float()]
```

Generates a list of eased values for animation frames.

## Examples

    # Generate 60 frames of cubic-eased animation
    frames = Visualize.Ease.frames(&Visualize.Ease.cubic_in_out/1, 60)

# `linear`

```elixir
@spec linear(number()) :: float()
```

Linear easing (no easing). Returns t unchanged.

# `names`

```elixir
@spec names() :: [atom()]
```

Returns all available easing function names.

# `poly_in`

```elixir
@spec poly_in(number(), number()) :: float()
```

Polynomial ease-in with configurable exponent.

## Examples

    poly_in(0.5, 2)  # Same as quad_in(0.5)
    poly_in(0.5, 3)  # Same as cubic_in(0.5)
    poly_in(0.5, 4)  # Quartic ease-in

# `poly_in_out`

```elixir
@spec poly_in_out(number(), number()) :: float()
```

Polynomial ease-in-out with configurable exponent

# `poly_out`

```elixir
@spec poly_out(number(), number()) :: float()
```

Polynomial ease-out with configurable exponent

# `quad_in`

```elixir
@spec quad_in(number()) :: float()
```

Quadratic ease-in: t²

# `quad_in_out`

```elixir
@spec quad_in_out(number()) :: float()
```

Quadratic ease-in-out

# `quad_out`

```elixir
@spec quad_out(number()) :: float()
```

Quadratic ease-out: 1 - (1-t)²

# `sin_in`

```elixir
@spec sin_in(number()) :: float()
```

Sinusoidal ease-in: 1 - cos(t * π/2)

# `sin_in_out`

```elixir
@spec sin_in_out(number()) :: float()
```

Sinusoidal ease-in-out: -(cos(πt) - 1) / 2

# `sin_out`

```elixir
@spec sin_out(number()) :: float()
```

Sinusoidal ease-out: sin(t * π/2)

---

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