# C#: Easing

Source: https://tweens.gd/csharp/api/easing/

Easing maps each leg’s progress to a weight between its endpoints. Pick one `In` and one `Out` curve and join them with `|`. The [easing playground](https://tweens.gd/easings/) draws every combination.

```csharp
sprite.TweenPositionX(300, 1.2, In.Sine | Out.Cubic);
```

## Members

| Member | Type | Default | Meaning |
| --- | --- | --- | --- |
| [`Ease`](https://tweens.gd/csharp/api/easing/#ease) | `EaseType` | `Linear` | An `In` curve, an `Out` curve, both joined with `|`, an `InOut` pair, or a [legacy ease](https://tweens.gd/porting/#legacy-eases) |
| [`BlendType`](https://tweens.gd/csharp/api/easing/#blendtype) | `BlendType` | `Makima` | How [mixed pairs](https://tweens.gd/csharp/api/easing/#mixed-pairs) join |
| [`Blend`](https://tweens.gd/csharp/api/easing/#blend) | `double` | `0.1` | Width of the centered join window, in `[0, 1]` |
| [`Skew`](https://tweens.gd/csharp/api/easing/#skew) | `double` | `0.5` | Where the outward leg splits between In and Out; see [pacing](https://tweens.gd/csharp/api/easing/#pacing) |
| [`Weks`](https://tweens.gd/csharp/api/easing/#weks) | `double` | `0.5` | Where the ping-pong return splits |
| [`EaseFunction`](https://tweens.gd/csharp/api/easing/#easefunction) | `Func<float, float>?` | `null` | Custom function of progress; overrides `Ease` |
| [`Curve`](https://tweens.gd/csharp/api/easing/#curve) | `Curve?` | `null` | Godot curve sampled over progress; overrides `Ease` |

## Families

-   `Linear`t
    
    In
    
    Out
    
    InOut
    
-   `Sine`1 − cos(πt/2)
    
    In
    
    Out
    
    InOut
    
-   `Quad`t²
    
    In
    
    Out
    
    InOut
    
-   `Cubic`t³
    
    In
    
    Out
    
    InOut
    
-   `Quart`t⁴
    
    In
    
    Out
    
    InOut
    
-   `Quint`t⁵
    
    In
    
    Out
    
    InOut
    
-   `Expo`2^(10t − 10)
    
    In
    
    Out
    
    InOut
    
-   `Circ`1 − √(1 − t²)
    
    In
    
    Out
    
    InOut
    
-   `SmoothStep`3t² − 2t³
    
    In
    
    Out
    
    InOut
    
-   `SmootherStep`so soft
    
    In
    
    Out
    
    InOut
    
-   `Back`overshoots
    
    In
    
    Out
    
    InOut
    
-   `Elastic`springs
    
    In
    
    Out
    
    InOut
    
-   `Bounce`rebounds
    
    In
    
    Out
    
    InOut
    
-   `Jump`hops
    
    In
    
    Out
    
    InOut
    

-   Every family is available as `In.X`, `Out.X`, and `InOut.X`; `InOut.Sine` is exactly `In.Sine | Out.Sine`.
-   `SmoothStep` and `SmootherStep` are symmetric, so their In and Out legs match.
-   Weights aren’t clamped: Back, Elastic, and Jump overshoot. Native property limits still apply.

## Composing

-   A single leg, such as `Out.Cubic`, runs over the whole duration.
-   `In.Sine | Out.Cubic` eases in with one family and out with another. Choose at most one of each side; two different In or two different Out flags are rejected.
-   `In.None` and `Out.None` omit a leg. `In.Linear` and `Out.Linear` select a straight line for that side of a mixed pair; no selection at all is linear.
-   `EaseType` constants work anywhere an ease is accepted: shorthand calls, definitions, `TweenOptions`, and [`Easing.Evaluate`](https://tweens.gd/csharp/api/easing/#sampling).

## Numbered variants

Back, Elastic, Bounce, and Jump come in five strengths, `10` to `50`, such as `Out.Elastic40` or `InOut.Back20`. The plain name is the `30` variant. The number is a percentage of the full tween range:

| Family | The number sets | `Out.X30` from 0 to 100 |
| --- | --- | --- |
| `Back` | Peak overshoot | Peaks at 130, then settles at 100 |
| `Elastic` | Peak overshoot | Swings to 130, then oscillates into 100 |
| `Bounce` | Depth of the first rebound | Reaches 100, falls back to 70, then rebounds a quarter and a sixteenth as deep |
| `Jump` | Height of the first hop above the target | Rises to 130, lands, then hops to 107.5 and 101.875 |

-   An `In` leg mirrors its motion: `In.Elastic30` dips to −30 before leaving.
-   A matching `InOut` pair keeps the percentage in each half: `InOut.Elastic30` reaches both extremes, and `InOut.Bounce30` rebounds 30 units in each half.
-   A single Elastic leg relaxes its damping after the main swing, so it settles at about 90% of the duration; a paired curve settles within each half. Both keep the named peak.
-   Jump stays above the target once it first reaches it.
-   In a mixed pair, the join can reshape overshoot or rebounds inside its window.

## Mixed pairs

At the neutral split, the In leg covers the first half of progress and of the value range, and the Out leg the second; every pair passes through (0.5, 0.5). Where two different families meet, a centered window of width `Blend` joins them:

| `BlendType` | Join |
| --- | --- |
| `Makima` | The default. Two cubics with matched velocity at the window’s edges, sharing a midpoint velocity from modified Akima weights |
| `Hermite` | Two cubics with matched velocity at the edges and equal acceleration at the midpoint |
| `SmoothStep` | Crossfades the two families’ InOut profiles with `u²(3 − 2u)` |
| `Linear` | Crossfades the profiles with `u`; velocity may jump at the window’s edges |

-   With the default width 0.1, progress up to 0.45 follows the In half exactly, and from 0.55 the Out half. A wider window reshapes more of each leg; zero splices the halves directly and may jump in velocity.
-   `Blend` must be finite and within `[0, 1]`.
-   All methods preserve the midpoint. For monotone families, Makima and Hermite add no reversals or overshoot; the crossfades can inherit steep midpoint slopes from a family such as Circ.
-   Matching families skip the join and use their paired profile.
-   Join settings don’t affect a single leg, a matching pair, a legacy ease, `EaseFunction`, or `Curve`.

The join, in detail

Each half is the family’s InOut half profile: for Sine, `0.5 * SineIn(2 * t)` and `0.5 + 0.5 * SineOut(2 * t - 1)`. Back, Elastic, and Jump are calibrated to their named overshoot, and Bounce to its first rebound depth.

Makima sets the midpoint velocity with the modified Akima weights of MATLAB’s [`makima`](https://www.mathworks.com/help/matlab/ref/makima.html): a weighted mean of the slopes on either side, favoring the half whose slope is steadier and closer to zero, so the result stays between them. Hermite solves the midpoint velocity from equal acceleration between the cubics, then limits it to prevent new reversals in monotone families. For a window half-width `h`, edge values `y0, y1`, and edge velocities `v0, v1`:

```text
d0 = (0.5 - y0) / h
d1 = (y1 - 0.5) / h
Makima:  w0 = |v1 - d1| + |v1 + d1| / 2
         w1 = |d0 - v0| + |d0 + v0| / 2
         midVelocity = (w0 * d0 + w1 * d1) / (w0 + w1)
Hermite: midVelocity = clamp((3 * (d0 + d1) - v0 - v1) / 4,
                             0, 3 * max(0, min(d0, d1)))
left cubic:  (0.5 - h, y0, v0) -> (0.5, 0.5, midVelocity)
right cubic: (0.5, 0.5, midVelocity) -> (0.5 + h, y1, v1)
```

The edge velocities stand in for the outer slopes that `makima` takes from neighboring samples. Both methods give a continuous velocity across the join at regular points of the source curves; acceleration can change at the window’s edges, and with Makima also at the midpoint.

## Pacing

`Skew` moves the outward leg’s In/Out split; `Weks` moves the ping-pong return’s.

-   At 0.5, the default, the pair stays balanced. At 0 the Out curve fills the whole leg; at 1 the In curve does. Values between move the split in both time and value, and the join window follows it, shrinking near either end.
-   `Weks = 1 - Skew` makes the return retrace the outward curve.
-   Duration, intervals, and the handle’s raw `Progress` stay unchanged.
-   Both apply to In/Out pairs. A single leg, a legacy ease, `EaseFunction`, and `Curve` keep their shape.
-   Moving the split redistributes the legs’ value ranges, so the numbered percentages describe the balanced pair.
-   Both must be finite and within `[0, 1]`, even without ping-pong.

## Custom functions and curves

-   `EaseFunction` maps normalized progress, from 0 to 1, to a weight. Return 0 at the start and 1 at the end for an ordinary arrival.
-   A Godot `Curve` is sampled over the same 0 to 1 domain. Each playback samples its own duplicate, so later edits reach only later starts.
-   Either one overrides `Ease`; setting both is rejected. If the function throws, the tween faults.
-   [Effects](https://tweens.gd/csharp/api/effects/) builds functions for punch, shake, and breathing; [Functions](https://tweens.gd/csharp/functions/) and [Curves](https://tweens.gd/csharp/curves/) show each in use.

## Sampling

| Method | Returns | Meaning |
| --- | --- | --- |
| [`Easing.Evaluate(ease, progress, blendType, blend, skew)`](https://tweens.gd/csharp/api/easing/#easing-evaluate-ease-progress-blendtype-blend-skew) | `float` | The weight at `progress`, without starting playback; the last three default to `Makima`, `0.1`, and `0.5` |
