An open API service indexing awesome lists of open source software.

https://github.com/deblasis/zioease

30+ easing functions for Zig animation. Comptime generic over f32/f64. 40 tests.
https://github.com/deblasis/zioease

game-engine gamedev gamedev-library zig zig-lang

Last synced: about 13 hours ago
JSON representation

30+ easing functions for Zig animation. Comptime generic over f32/f64. 40 tests.

Awesome Lists containing this project

README

          

# zioease

> 30+ easing functions for Zig animation and tweening. Pure Zig, comptime generic over f32/f64.

Part of the [zio-zig](https://github.com/deblasis/zio-zig) ecosystem.

## Quick start

```zig
const ease = @import("zioease");

// Standard easing: pass a type and t ∈ [0, 1], get a value ∈ [0, 1]
const v1 = ease.linear(f32, 0.5); // 0.5
const v2 = ease.quadIn(f32, 0.5); // 0.25
const v3 = ease.bounceOut(f32, 0.5); // ~0.765
const v4 = ease.elasticOut(f32, 0.5); // ~1.089 (overshoots)

// Use with any float type
const v5 = ease.cubicInOut(f64, 0.25);
```

```bash
zig build test # Run 40 tests
zig build run-example # Run example
```

## Example output

```
$ zig build run-example
At t=0.5:
linear: 0.5
quadIn: 0.25
quadOut: 0.75
cubicIn: 0.13
sineOut: 0.71
Elastic at t=0.4: 1.031 (overshoots past 1!)
Bounce at t=0.6: 0.773
```

## API

All functions have the signature `fn(comptime T: type, t: T) T` where `t ∈ [0, 1]`.

### Linear
- `linear` — uniform speed

### Quadratic
- `quadIn`, `quadOut`, `quadInOut`

### Cubic
- `cubicIn`, `cubicOut`, `cubicInOut`

### Quartic
- `quartIn`, `quartOut`, `quartInOut`

### Quintic
- `quintIn`, `quintOut`, `quintInOut`

### Sine
- `sineIn`, `sineOut`, `sineInOut`

### Exponential
- `expoIn`, `expoOut`, `expoInOut`

### Circular
- `circIn`, `circOut`, `circInOut`

### Elastic (overshoots target)
- `elasticIn`, `elasticOut`, `elasticInOut`

### Back (pulls back before accelerating)
- `backIn`, `backOut`, `backInOut`

### Bounce (bounces at the end)
- `bounceIn`, `bounceOut`, `bounceInOut`

## License

MIT. Copyright (c) 2026 Alessandro De Blasis.